websocket

package
v0.0.0-...-d1b097e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExpectedWSCloseError

func IsExpectedWSCloseError(err error) bool

IsExpectedWSCloseError returns boolean indicating whether the error is a clean disconnection.

Types

type DialErr

type DialErr struct {
	URL          *url.URL
	HTTPResponse *http.Response
}

func (DialErr) Error

func (de DialErr) Error() string

type Websocket

type Websocket interface {
	io.Reader
	io.Writer
	Close() error
}

Websocket exposes the bits of *websocket.Conn we actually use. Note that we are emulating an `io.ReadWriter`. This is to be able to support RPC codecs, which operate on byte streams.

func Dial

func Dial(client *http.Client, ua string, token client.Token, u *url.URL) (Websocket, error)

Dial initiates a new websocket connection.

func Ping

func Ping(c *websocket.Conn) Websocket

Ping adds a periodic ping to a websocket connection.

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (Websocket, error)

Upgrade upgrades the HTTP server connection to the WebSocket protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL