parser

package
v0.0.0-...-ad46f1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL