wstransport

package
v0.0.0-...-511b1a1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	// ReadJSON reads the next JSON-encoded message from the connection and
	// stores it in the value pointed to by v.
	ReadJSON(v interface{}) error
	// WriteJSON writes the JSON encoding of v as a message.
	WriteJSON(v interface{}) error
	// NextReader returns the next data message received from the peer. The
	// returned messageType is either TextMessage or BinaryMessage.
	NextReader() (messageType int, r io.Reader, err error)
	// NextWriter returns a writer for the next message to send. The writer's
	// Close method flushes the complete message to the network.
	NextWriter(messageType int) (io.WriteCloser, error)
	// Error writes an error response including the given operation and error
	// message. The error is also returned.
	Error(op apiparams.Operation, err error) error
	// OK writes a success response with the given operation and formatted text
	// as a message.
	OK(op apiparams.Operation, format string, a ...interface{}) error
	// Close closes the WebSocket connection.
	Close() error
}

Conn describes a WebSocket connection.

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request) (Conn, error)

Upgrade upgrades the HTTP server connection to the WebSocket protocol. If the upgrade fails, then Upgrade replies to the client with an HTTP error.

Jump to

Keyboard shortcuts

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