Documentation ¶ Index ¶ type Decoder func NewDecoder(compression bool, base64 bool) *Decoder func (d *Decoder) Decode(data []byte) (_ *Model, err error) type Encoder func NewEncoder(compression bool, base64 bool) *Encoder func (e *Encoder) Encode(model *Model) (data []byte, err error) type Model type Type Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Decoder ¶ type Decoder struct { // contains filtered or unexported fields } func NewDecoder ¶ func NewDecoder(compression bool, base64 bool) *Decoder func (*Decoder) Decode ¶ func (d *Decoder) Decode(data []byte) (_ *Model, err error) type Encoder ¶ type Encoder struct { // contains filtered or unexported fields } func NewEncoder ¶ func NewEncoder(compression bool, base64 bool) *Encoder func (*Encoder) Encode ¶ func (e *Encoder) Encode(model *Model) (data []byte, err error) type Model ¶ type Model struct { Type Type `json:"type"` Event *string `json:"event"` Data *interface{} `json:"data"` Message *string `json:"message"` // error message or disconnect reason } {type: 1, "event":"message","data":{"message":"Hello World"}} type Type ¶ type Type int const ( Connected Type = 0 Disconnect Type = 1 Event Type = 2 Error Type = 3 ) Source Files ¶ View all Source files decoder.go encoder.go model.go Click to show internal directories. Click to hide internal directories.