Documentation
¶
Overview ¶
Package packet defines the Engine.IO packet types and structures.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Compress indicates whether the packet should be compressed.
Compress *bool `json:"compress,omitempty" msgpack:"compress,omitempty"`
// WsPreEncodedFrame contains a pre-encoded WebSocket frame.
WsPreEncodedFrame types.BufferInterface `json:"wsPreEncodedFrame,omitempty" msgpack:"wsPreEncodedFrame,omitempty"`
}
Options contains optional packet configuration.
func NewOptions ¶
NewOptions creates a new Options with the given compress flag.
type Packet ¶
type Packet struct {
// Type is the packet type (OPEN, CLOSE, PING, PONG, MESSAGE, UPGRADE, NOOP, ERROR).
Type Type `json:"type" msgpack:"type"`
// Data contains the packet payload.
Data io.Reader `json:"data,omitempty" msgpack:"data,omitempty"`
// Options contains optional packet configuration.
Options *Options `json:"options,omitempty" msgpack:"options,omitempty"`
}
Packet represents an Engine.IO packet.
type Type ¶
type Type string
Type represents the Engine.IO packet type.
const ( // OPEN is sent from the server when a new transport is opened. OPEN Type = "open" // CLOSE is sent to request the close of this transport. CLOSE Type = "close" // PING is sent by the client for keep-alive (heartbeat). PING Type = "ping" // PONG is sent by the server in response to a PING. PONG Type = "pong" // MESSAGE is used for actual message transport. MESSAGE Type = "message" // UPGRADE is sent before upgrading the transport. UPGRADE Type = "upgrade" // NOOP is used as a no-operation packet. NOOP Type = "noop" // ERROR indicates a parsing or other error. ERROR Type = "error" )
Packet types for Engine.IO protocol.
Click to show internal directories.
Click to hide internal directories.