ws

package
v0.0.0-...-1fae330 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ws provides a WebSocket transport wrapper for connecting to Rust companion servers.

Index

Constants

View Source
const DefaultReadLimit = 32 * 1024 * 1024

DefaultReadLimit is the maximum size in bytes allowed for received WebSocket messages (32 MB).

Variables

View Source
var ErrUnexpectedMessageType = errors.New("unexpected non-binary websocket message type")

ErrUnexpectedMessageType is returned when a received WebSocket frame is not binary.

Functions

func BuildURL

func BuildURL(server string, port uint16, useFacepunchProxy bool) string

BuildURL constructs the WebSocket endpoint URL based on host, port, and whether the Facepunch proxy is used.

Types

type Conn

type Conn interface {
	// Send writes a binary message to the WebSocket.
	Send(ctx context.Context, data []byte) error
	// Recv reads a binary message from the WebSocket.
	Recv(ctx context.Context) ([]byte, error)
	// Close gracefully closes the WebSocket connection.
	Close() error
}

Conn is the transport interface for sending and receiving raw bytes over WebSocket.

func Dial

func Dial(ctx context.Context, server string, port uint16, useFacepunchProxy bool) (Conn, error)

Dial connects to a Rust companion WebSocket server or proxy and returns a Conn.

Jump to

Keyboard shortcuts

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