...
Package ws
Wrap an HTTP2 connection over WebSockets and
use the underlying WebSocket framing for proxy
compatibility.
type Conn struct {
*websocket.Conn
}
▾ Example
Connect to the Websocket endpoint at ws://localhost
using SPDY over Websockets framing.
Code:
wsconn, _, _ := websocket.DefaultDialer.Dial("ws://localhost/", http.Header{"Origin": {"http://localhost/"}})
conn, _ := spdystream.NewConnection(NewConnection(wsconn), false)
go conn.Serve(spdystream.NoOpStreamHandler)
stream, _ := conn.CreateStream(http.Header{}, nil, false)
stream.Wait()
func NewConnection(w *websocket.Conn) *Conn
func (*Conn) Close
¶
func (c *Conn) Close() error
func (*Conn) Read
¶
func (c *Conn) Read(b []byte) (int, error)
func (c *Conn) SetDeadline(t time.Time) error
func (*Conn) Write
¶
func (c *Conn) Write(b []byte) (int, error)