package
0.0.0-20241031100844-bda827571e18
Repository: https://github.com/csdenboer/sonic.git
Documentation: pkg.go.dev

# README

Compliance

sonic.websocket uses the autobahn-testsuite to validate the WebSocket implementation. sonic.websocket implements most of the WebSocket protocol with the exception of:

  • DEFLATE compression
  • UTF8 handling.

Notes

There are two state machines that combined form a stateful WebSocket parser.

  • FrameCodec handles the state of a frame where the smallest unit is a byte.
  • WebsocketStream handles the state of the whole stream where the smallest unit is a frame. WebsocketStream uses FrameCodec.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IsUpgradeReq returns true if the HTTP request is a valid WebSocket upgrade.
IsUpgradeReq returns true if the HTTP response is a valid WebSocket upgrade.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

CloseAbnormal means the connection was closed without receiving a close frame.
CloseBadPayload means the endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message).
GoingaAway means endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection.
CloseInternalError means the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
CloseNeedsExtension means the client is terminating the connection because it expected the server to negotiate one or more extensions, but the server didn't.
CloseNone is used internally to mean "no error" This code is reserved and may not be sent.
CloseNormal signifies normal closure; the connection successfully completed whatever purpose for which it was created.
CloseNoStatus means no status code was provided in the close frame sent by the peer, even though one was expected.
ClosePolicyError means the endpoint is terminating the connection because it received a message that violates its policy.
CloseProtocolError means the endpoint is terminating the connection due to a protocol error.
CloseReserved1 is reserved for future use by the WebSocket standard.
CloseReserved2 is reserved for future use by the WebSocket standard.
CloseReserved3 is reserved for future use by the WebSocket standard.
CloseServiceRestart means the server is terminating the connection because it is restarting.
CloseTooBig means the endpoint is terminating the connection because a data frame was received that is too large.
CloseTryAgainLater means the server is terminating the connection due to a temporary condition, e.g.
CloseUnknownData means the connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data).
The max size of the ping/pong control frame payload.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No `iota` here for clarity.
No description provided by the author
No description provided by the author
Intermediate state.
Terminal state.
Terminal state.
Intermediate state.
Start state.
Terminal state.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GUID is used when constructing the Sec-WebSocket-Accept key based on Sec-WebSocket-Key.
the maximum size of a message.

# Structs

No description provided by the author
FrameCodec is a stateful streaming parser handling the encoding and decoding of WebSocket frames.
No description provided by the author
MockServer is a server which can be used to test the WebSocket client.
MockStream is a mock TCP stream that's not attached to any operating system IO executor.
No description provided by the author

# Interfaces

Stream is an interface for representing a stateful WebSocket connection on the server or client side.

# Type aliases

No description provided by the author
No description provided by the author
Close status codes.
No description provided by the author
No description provided by the author
No description provided by the author
The type representing the reason string in a close frame.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author