Documentation
¶
Index ¶
Constants ¶
View Source
const ProtocolVersion = 4
Variables ¶
This section is empty.
Functions ¶
func EncodePayloads ¶
packets must not be nil.
Note: Writer should either implement io.ByteWriter or it should not have a problem with writing 1 byte at a time.
func EncodedPayloadsLen ¶
`packets` must not be nil.
Types ¶
type HandshakeResponse ¶
type HandshakeResponse struct {
SID string `json:"sid"`
Upgrades []string `json:"upgrades"`
PingInterval int64 `json:"pingInterval"`
PingTimeout int64 `json:"pingTimeout"`
MaxPayload int64 `json:"maxPayload"`
}
func ParseHandshakeResponse ¶
func ParseHandshakeResponse(p *Packet) (*HandshakeResponse, error)
func (*HandshakeResponse) GetPingInterval ¶
func (hr *HandshakeResponse) GetPingInterval() time.Duration
func (*HandshakeResponse) GetPingTimeout ¶
func (hr *HandshakeResponse) GetPingTimeout() time.Duration
type Packet ¶
type Packet struct {
IsBinary bool
Type PacketType
Data []byte
}
func (*Packet) Encode ¶
Note: Writer should either implement io.ByteWriter or should not have a problem with writing 1 byte at a time.
func (*Packet) EncodedLen ¶
type PacketType ¶
type PacketType byte
const ( PacketTypeOpen PacketType = iota PacketTypeClose PacketTypePing PacketTypePong PacketTypeMessage PacketTypeUpgrade PacketTypeNoop )
func (*PacketType) FromChar ¶
func (p *PacketType) FromChar(b byte) error
func (PacketType) ToChar ¶
func (p PacketType) ToChar() byte
Click to show internal directories.
Click to hide internal directories.