Categorygithub.com/gorilla/websocket
modulepackage
1.5.3
Repository: https://github.com/gorilla/websocket.git
Documentation: pkg.go.dev

# README

Gorilla WebSocket

GoDoc CircleCI

Gorilla WebSocket is a Go implementation of the WebSocket protocol.

Documentation

Status

The Gorilla WebSocket package provides a complete and tested implementation of the WebSocket protocol. The package API is stable.

Installation

go get github.com/gorilla/websocket

Protocol Compliance

The Gorilla WebSocket package passes the server tests in the Autobahn Test Suite using the application in the examples/autobahn subdirectory.

# Packages

# Functions

FormatCloseMessage formats closeCode and text as a WebSocket close message.
IsCloseError returns boolean indicating whether the error is a *CloseError with one of the specified codes.
IsUnexpectedCloseError returns boolean indicating whether the error is a *CloseError with a code not in the list of expected codes.
IsWebSocketUpgrade returns true if the client requested upgrade to the WebSocket protocol.
JoinMessages concatenates received messages to create a single io.Reader.
NewClient creates a new client connection using the given net connection.
NewPreparedMessage returns an initialized PreparedMessage.
ReadJSON reads the next JSON-encoded message from the connection and stores it in the value pointed to by v.
Subprotocols returns the subprotocols requested by the client in the Sec-Websocket-Protocol header.
Upgrade upgrades the HTTP server connection to the WebSocket protocol.
WriteJSON writes the JSON encoding of v as a message.

# Constants

BinaryMessage denotes a binary data message.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
CloseMessage denotes a close control message.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
Close codes defined in RFC 6455, section 11.7.
PingMessage denotes a ping control message.
PongMessage denotes a pong control message.
TextMessage denotes a text data message.

# Variables

DefaultDialer is a dialer with all fields set to the default values.
ErrBadHandshake is returned when the server response to opening handshake is invalid.
ErrCloseSent is returned when the application writes a message to the connection after sending a close message.
ErrReadLimit is returned when reading a message that is larger than the read limit set for the connection.

# Structs

CloseError represents a close message.
The Conn type represents a WebSocket connection.
A Dialer contains options for connecting to WebSocket server.
HandshakeError describes an error with the handshake from the peer.
PreparedMessage caches on the wire representations of a message payload.
Upgrader specifies parameters for upgrading an HTTP connection to a WebSocket connection.

# Interfaces

BufferPool represents a pool of buffers.