package
1.4.0
Repository: https://github.com/gobwas/ws.git
Documentation: pkg.go.dev

# Functions

ControlFrameHandler returns FrameHandlerFunc for handling control frames.
GetWriter tries to reuse Writer getting it from the pool.
HandleClientControlMessage handles control frame from conn and writes response when needed.
HandleControlMessage handles message which was read by ReadMessage() functions.
HandleServerControlMessage handles control frame from conn and writes response when needed.
NewCipherReader creates xor-cipher reader from r with given mask.
NewCipherWriter creates xor-cipher writer to w with given mask.
NewClientSideReader is a helper function that calls NewReader with r and ws.StateClientSide.
NewControlWriter contains ControlWriter with Writer inside whose buffer size is at most ws.MaxControlFramePayloadSize + ws.MaxHeaderSize.
NewControlWriterBuffer returns a new ControlWriter with buf as a buffer.
NewReader creates new frame reader that reads from r keeping given state to make some protocol validity checks when it needed.
NewServerSideReader is a helper function that calls NewReader with r and ws.StateServerSide.
NewUTF8Reader creates utf8 reader that reads from r.
NewWriter returns a new Writer whose buffer has the DefaultWriteBuffer size.
NewWriterBuffer returns a new Writer with buf as a buffer.
NewWriterBufferSize returns a new Writer whose buffer size is equal to n.
NewWriterSize returns a new Writer whose buffer size is at most n + ws.MaxHeaderSize.
NextReader prepares next message read from r.
PutWriter puts w for future reuse by GetWriter().
ReadClientBinary reads next binary message from rw, considering that caller represents server side.
ReadClientData reads next data message from rw, considering that caller represents server side.
ReadClientMessage reads next message from r, considering that caller represents server side.
ReadClientText reads next text message from rw, considering that caller represents server side.
ReadData is a helper function that reads next data (non-control) message from rw.
ReadMessage is a helper function that reads next message from r.
ReadServerBinary reads next binary message from rw, considering that caller represents client side.
ReadServerData reads next data message from rw, considering that caller represents client side.
ReadServerMessage reads next message from r, considering that caller represents client side.
ReadServerText reads next text message from rw, considering that caller represents client side.
WriteClientBinary is the same as WriteClientMessage with ws.OpBinary.
WriteClientMessage writes message to w, considering that caller represents client side.
WriteClientText is the same as WriteClientMessage with ws.OpText.
WriteMessage is a helper function that writes message to the w.
WriteServerBinary is the same as WriteServerMessage with ws.OpBinary.
WriteServerMessage writes message to w, considering that caller represents server side.
WriteServerText is the same as WriteServerMessage with ws.OpText.

# Variables

DefaultWriteBuffer contains size of Writer's default buffer.
ErrControlOverflow is returned by ControlWriter.Write() to indicate that no more data could be written to the underlying io.Writer because MaxControlFramePayloadSize limit is reached.
ErrFrameTooLarge indicates that a message of length higher than MaxFrameSize was being read.
ErrInvalidUTF8 is returned by UTF8 reader on invalid utf8 sequence.
ErrNoFrameAdvance means that Reader's Read() method was called without preceding NextFrame() call.
ErrNotControlFrame is returned by ControlHandler to indicate that given header could not be handled.
ErrNotEmpty is returned by Writer.WriteThrough() to indicate that buffer is not empty and write through could not be done.

# Structs

CipherReader implements io.Reader that applies xor-cipher to the bytes read from source.
CipherWriter implements io.Writer that applies xor-cipher to the bytes written to the destination writer.
ClosedError returned when peer has closed the connection with appropriate code and a textual reason.
ControlHandler contains logic of handling control frames.
ControlWriter is a wrapper around Writer that contains some guards for buffered writes of control frames.
DebugDialer is a wrapper around ws.Dialer.
DebugUpgrader is a wrapper around ws.Upgrader.
Message represents a message from peer, that could be presented in one or more frames.
Reader is a wrapper around source io.Reader which represents WebSocket connection.
UTF8Reader implements io.Reader that calculates utf8 validity state after every read byte from Source.
Writer contains logic of buffering output data into a WebSocket fragments.

# Interfaces

RecvExtension is an interface for clearing fragment header RSV bits.
SendExtension is an interface for setting fragment header RSV bits.

# Type aliases

FrameHandlerFunc handles parsed frame header and its body represented by io.Reader.
RecvExtensionFunc is an adapter to allow the use of ordinary functions as RecvExtension.
SendExtensionFunc is an adapter to allow the use of ordinary functions as SendExtension.