protocol

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Protocol ws.Protocol[Message] = protocol{}

Functions

func Encode

func Encode(message Message) ([]byte, error)

Types

type CloseMessage

type CloseMessage struct {
	Reason string
}

A message indicating the connection is complete.

func (CloseMessage) Type

func (i CloseMessage) Type() MessageType

type DataMessage

type DataMessage struct {
	Data []byte
}

type ErrorMessage

type ErrorMessage struct {
	Message string
}

Send an error to the client. Used before closing the connection.

func (ErrorMessage) Type

func (i ErrorMessage) Type() MessageType

type HandshakeMessage

type HandshakeMessage struct {
	Env     map[string]string
	Shell   string
	Size    geom.Vec2
	Profile termenv.Profile
}

The initial information necessary to render to the client.

func (HandshakeMessage) Type

func (i HandshakeMessage) Type() MessageType

type InputMessage

type InputMessage DataMessage

Represents client input (typically, typing.)

func (InputMessage) Type

func (i InputMessage) Type() MessageType

type Message

type Message interface {
	Type() MessageType
}

func Decode

func Decode(data []byte) (Message, error)

type MessageType

type MessageType int
const (
	MessageTypeHandshake MessageType = iota
	MessageTypeError
	MessageTypeSize
	MessageTypeInput
	MessageTypeOutput
	MessageTypeClose
)

type OutputMessage

type OutputMessage DataMessage

Output that should be sent to the client.

func (OutputMessage) Type

func (i OutputMessage) Type() MessageType

type SizeMessage

type SizeMessage struct {
	Rows    int
	Columns int
}

Used when the client terminal is resized.

func (SizeMessage) Type

func (i SizeMessage) Type() MessageType

Jump to

Keyboard shortcuts

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