websocket

package module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: GPL-3.0, LGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongMessageTypeReceived = errors.New("Wrong message type received")

Functions

func Close added in v0.2.0

func Close(c *websocket.Conn) error

func CloseWithStatus added in v0.2.0

func CloseWithStatus(c *websocket.Conn, closeCode CloseCode, closeText string) error

func ReadJSON

func ReadJSON(ws *websocket.Conn, v any) error

func ReadString

func ReadString(ws *websocket.Conn) (string, error)

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*websocket.Conn, error)

func WriteJSON

func WriteJSON(ws *websocket.Conn, message any) error

func WriteString

func WriteString(ws *websocket.Conn, message string) error

Types

type CloseCode added in v0.2.0

type CloseCode int
const (
	CloseNormalClosure CloseCode = iota
	CloseGoingAway
	CloseProtocolError
	CloseUnsupportedData
	CloseNoStatusReceived
	CloseAbnormalClosure
	CloseInvalidFramePayloadData
	ClosePolicyViolation
	CloseMessageTooBig
	CloseMandatoryExtension
	CloseInternalServerErr
	CloseServiceRestart
	CloseTryAgainLater
	CloseTLSHandshake
)

Jump to

Keyboard shortcuts

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