parser

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: BSD-3-Clause Imports: 10 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPacketType = errors.New("invalid packet type")
)

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Data []byte
	// contains filtered or unexported fields
}

Buffer is an binary buffer handler used in emit args. All buffers will be sent as binary in the transport layer.

func (Buffer) MarshalJSON

func (a Buffer) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON.

func (*Buffer) UnmarshalJSON

func (a *Buffer) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal data from JSON.

type BufferData added in v1.5.0

type BufferData struct {
	Num         uint64
	PlaceHolder bool `json:"_placeholder"`
	Data        []byte
}

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(r FrameReader) *Decoder

func (*Decoder) Close

func (d *Decoder) Close() error

func (*Decoder) DecodeArgs

func (d *Decoder) DecodeArgs(types []reflect.Type) ([]reflect.Value, error)

func (*Decoder) DecodeHeader

func (d *Decoder) DecodeHeader(header *Header, event *string) error

func (*Decoder) DiscardLast

func (d *Decoder) DiscardLast() (err error)

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(w FrameWriter) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(h Header, args ...interface{}) (err error)

type FrameReader

type FrameReader interface {
	NextReader() (session.FrameType, io.ReadCloser, error)
}

type FrameWriter

type FrameWriter interface {
	NextWriter(ft session.FrameType) (io.WriteCloser, error)
}
type Header struct {
	Type      Type
	ID        uint64
	NeedAck   bool
	Namespace string
	Query     string
}

Header of packet.

type Payload added in v1.5.0

type Payload struct {
	Header Header

	Data []interface{}
}

Payload of packet.

type Type

type Type byte

Type of packet.

const (
	// Connect type
	Connect Type = iota
	// Disconnect type
	Disconnect
	// Event type
	Event
	// Ack type
	Ack
	// Error type
	Error
)

Jump to

Keyboard shortcuts

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