protocol

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-3.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/**
	Message with connection options
	*/
	MessageTypeOpen = iota
	/**
	Close connection and destroy all handle routines
	*/
	MessageTypeClose = iota
	/**
	Ping request message
	*/
	MessageTypePing = iota
	/**
	Pong response message
	*/
	MessageTypePong = iota
	/**
	Empty message
	*/
	MessageTypeEmpty = iota
	/**
	Emit request, no response
	*/
	MessageTypeEmit = iota
	/**
	Emit request, wait for response (ack)
	*/
	MessageTypeAckRequest = iota
	/**
	ack response
	*/
	MessageTypeAckResponse = iota
)
View Source
const (
	CloseMessage = "1"
	PingMessage  = "2"
	PongMessage  = "3"
)

Variables

View Source
var (
	ErrorWrongMessageType = errors.New("Wrong message type")
	ErrorWrongPacket      = errors.New("Wrong packet")
)

Functions

func Encode

func Encode(msg *Message) (string, error)

func MustEncode

func MustEncode(msg *Message) string

Types

type Message

type Message struct {
	Type   int
	AckId  int
	Method string
	Args   string
	Source string
}

func Decode

func Decode(data string) (*Message, error)

Jump to

Keyboard shortcuts

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