parser

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SEPARATOR = byte(0x1E)

Variables

View Source
var (
	PACKET_TYPES map[packet.Type]byte = map[packet.Type]byte{
		packet.OPEN:    '0',
		packet.CLOSE:   '1',
		packet.PING:    '2',
		packet.PONG:    '3',
		packet.MESSAGE: '4',
		packet.UPGRADE: '5',
		packet.NOOP:    '6',
	}

	PACKET_TYPES_REVERSE map[byte]packet.Type = map[byte]packet.Type{
		'0': packet.OPEN,
		'1': packet.CLOSE,
		'2': packet.PING,
		'3': packet.PONG,
		'4': packet.MESSAGE,
		'5': packet.UPGRADE,
		'6': packet.NOOP,
	}

	ERROR_PACKET = &packet.Packet{Type: packet.ERROR, Data: types.NewStringBufferString(`parser error`)}
)

Packet types.

Functions

This section is empty.

Types

type Parser

type Parser interface {
	Protocol() int
	EncodePacket(*packet.Packet, bool, ...bool) (types.BufferInterface, error)
	DecodePacket(types.BufferInterface, ...bool) (*packet.Packet, error)
	EncodePayload([]*packet.Packet, ...bool) (types.BufferInterface, error)
	DecodePayload(types.BufferInterface) []*packet.Packet
}

func Parserv3

func Parserv3() Parser

func Parserv4

func Parserv4() Parser

Jump to

Keyboard shortcuts

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