Documentation ¶
Overview ¶
Package ssmp provides constants and utilities shared between client and server.
Index ¶
- Constants
- Variables
- func Equal(b []byte, s string) bool
- func IsValidIdentifier(s string) bool
- type ByteSet
- type ByteSetInitializer
- type Decoder
- func (d *Decoder) AtEnd() bool
- func (d *Decoder) DecodeCode() (int, error)
- func (d *Decoder) DecodeCompat() ([]byte, error)
- func (d *Decoder) DecodeId() ([]byte, error)
- func (d *Decoder) DecodePayload() ([]byte, error)
- func (d *Decoder) DecodeVerb() ([]byte, error)
- func (d *Decoder) RawMessage() []byte
- func (d *Decoder) Reset()
Constants ¶
View Source
const ( CodeLength = 3 MaxVerbLength = 16 MaxIdentifierLength = 64 MaxPayloadLength = 1024 BinaryPayloadPrefix = 2 MaxMessageLength = CodeLength + 5 + MaxVerbLength + 2*MaxIdentifierLength + BinaryPayloadPrefix + MaxPayloadLength )
View Source
const ( LOGIN = "LOGIN" SUBSCRIBE = "SUBSCRIBE" UNSUBSCRIBE = "UNSUBSCRIBE" UCAST = "UCAST" MCAST = "MCAST" BCAST = "BCAST" PING = "PING" PONG = "PONG" CLOSE = "CLOSE" )
Requests
View Source
const ( CodeEvent = 0 CodeOk = 200 CodeBadRequest = 400 CodeNotFound = 404 )
Response codes
View Source
const Anonymous = "."
Reserved identifier for anonymous login.
View Source
const (
PRESENCE = "PRESENCE"
)
Options
Variables ¶
View Source
var ErrInvalidMessage error = fmt.Errorf("invalid message")
Functions ¶
func IsValidIdentifier ¶
IsValidIdentifier reports whether s is a valid SSMP IDENTIFIER field.
Types ¶
type ByteSet ¶
type ByteSet struct {
// contains filtered or unexported fields
}
A ByteSet is a compact representation of an immutable set of bytes, which offers constant-time membership queries.
var ID_CHARSET *ByteSet = NewByteSet( Range('a', 'z'), Range('A', 'Z'), Range('0', '9'), All(".:@/-_+=~"), )
ID_CHARSET is a ByteSet matching SSMP IDENTIFIER fields.
var VERB_CHARSET *ByteSet = NewByteSet( Range('A', 'Z'), )
VERB_CHARSRT is a ByteSet matching SSMP VERB fields.
func NewByteSet ¶
func NewByteSet(initializers ...ByteSetInitializer) *ByteSet
Creates a new ByteSet as the union of the given initializers.
type ByteSetInitializer ¶
type ByteSetInitializer func(*ByteSet)
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func (*Decoder) DecodeCode ¶
func (*Decoder) DecodeCompat ¶
optional id and optional payload
func (*Decoder) DecodePayload ¶
func (*Decoder) DecodeVerb ¶
func (*Decoder) RawMessage ¶
Click to show internal directories.
Click to hide internal directories.