Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnexpectedType = errors.New("Unexpected type")
ErrUnexpectedType is returned when the decoder is trying to replace placeholders with []byte and encounters an unexpected type
var ErrWaitingForMorePackets = errors.New("Waiting for more packets")
ErrWaitingForMorePackets is returned when the Decoder has not yet received enough BinaryPackets to fully decode a binary message
Functions ¶
func HasBinary ¶
func HasBinary(data interface{}) bool
HasBinary returns true if the data contains []byte or fixed-length byte arrays, false otherwise
func IsRootNamespace ¶
IsRootNamespace returns true if the namespace is / or "", false otherwise
Types ¶
type BinaryDecoder ¶
type BinaryDecoder struct {
// contains filtered or unexported fields
}
BinaryDecoder reconstructs BinaryEvents and BinaryAcks from multiple EnginePackets
func (*BinaryDecoder) Decode ¶
func (d *BinaryDecoder) Decode(packet engine.Packet) (Packet, error)
Decode returns either a Message, or ErrWaitingForMorePackets if additional Packets are required to fully reconstruct a BinaryEvent or BinaryAck
func (*BinaryDecoder) Reset ¶
func (d *BinaryDecoder) Reset()
Reset clears the current state of the BinaryDecoder
type BinaryPlaceholder ¶
BinaryPlaceholder represents the position of a particular binary attachement in a string-encoded packet
type Packet ¶
type Packet struct {
Type PacketType
ID *int64
Namespace string
AttachmentCount int
Data interface{}
}
Packet is a Socket.IO packet
type PacketType ¶
type PacketType int
PacketType is the Socket.IO-defined type of this packet
const ( // Connect represents a packet that is sent when the remote connection is // initially established Connect PacketType = iota // Disconnect represents a packet that is sent when the remote connection is broken // either intentionally or unintentionally Disconnect // Event represents a packet that contains event information. Packets of this type // may be sent by either side at any time after the connection is established Event // Ack represents a packet that contains a payload acknowledging receipt of a previously // sent Event Ack // Error represents a packet that contains error information Error // BinaryEvent represents a packet that contains event information. Packets of this type // may be sent by either side at any time after the connection is established BinaryEvent // BinaryAck represents a packet that contains a payload acknowledging receipt of a previously // sent Event BinaryAck )