protocol

package
v0.0.0-...-a5d02c2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeOpen = iota
	MessageTypeClose
	MessageTypePing
	MessageTypePong
	MessageTypeEmpty
	MessageTypeEmit
	MessageTypeAckRequest
	MessageTypeAckResponse
)
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