parser

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: BSD-3-Clause Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

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