Documentation
¶
Index ¶
Constants ¶
View Source
const Protocol = 5
Protocol version.
Variables ¶
View Source
var ( // These strings must not be used as event names, as they have a special meaning. RESERVED_EVENTS = types.NewSet( "connect", "connect_error", "disconnect", "disconnecting", ) )
Functions ¶
Types ¶
type Decoder ¶
type Decoder interface {
events.EventEmitter
Add(any) error
Destroy()
}
Decoder defines an interface for socket.io decoding.
func NewDecoder ¶
func NewDecoder() Decoder
type Encoder ¶
type Encoder interface {
Encode(*Packet) []types.BufferInterface
}
Encoder defines an interface for socket.io encoding.
func NewEncoder ¶
func NewEncoder() Encoder
type Packet ¶
type Packet struct {
Type PacketType `json:"type" msgpack:"type"`
Nsp string `json:"nsp" msgpack:"nsp"`
Data any `json:"data,omitempty" msgpack:"data,omitempty"`
Id *uint64 `json:"id,omitempty" msgpack:"id,omitempty"`
Attachments *uint64 `json:"attachments,omitempty" msgpack:"attachments,omitempty"`
}
func DeconstructPacket ¶
func DeconstructPacket(packet *Packet) (pack *Packet, buffers []types.BufferInterface)
Replaces every io.Reader | []byte in packet with a numbered placeholder.
func ReconstructPacket ¶
func ReconstructPacket(packet *Packet, buffers []types.BufferInterface) (*Packet, error)
Reconstructs a binary packet from its placeholder packet and buffers
type PacketType ¶
type PacketType byte
const ( CONNECT PacketType = '0' DISCONNECT PacketType = '1' EVENT PacketType = '2' ACK PacketType = '3' CONNECT_ERROR PacketType = '4' BINARY_EVENT PacketType = '5' BINARY_ACK PacketType = '6' )
func (PacketType) String ¶
func (t PacketType) String() string
func (PacketType) Valid ¶
func (t PacketType) Valid() bool
type Placeholder ¶
Click to show internal directories.
Click to hide internal directories.