call

package
v0.1.53 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SocketCodeUnknownProtocol = 3000
	SocketCodeExcessTraffic   = 3001
	SocketCodeBadCallId       = 3002
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveCall

type ActiveCall interface {
	// SessionID returns the globally unique ID for this session in this process.
	// It is always an unsigned int safe for use in JavaScript.
	SessionID() int

	// ReadJSON reads JSON for the call into the given pointer.
	ReadJSON(v any) error

	// WriteJSON writes JSON from the given pointer to the call.
	WriteJSON(v any) error
}

type CallHandler

type CallHandler func(context.Context, ActiveCall) error

CallHandler is invoked for each new remote call.

type Handler

type Handler struct {
	Handler CallHandler

	// SkipOriginVerify allows any hostname to connect here, not just our own.
	SkipOriginVerify bool

	// CallLimit optionally limits the number of calls allowed by a single session.
	// This is probably just each WebSocket connection.
	// A session will be killed if it exceeds this rate; the client must know it too.
	CallLimit *LimitConfig

	// PacketLimit optionally limits the number of packets allowed across all calls.
	// This includes call setup/metadata packets.
	// A session will be killed if it exceeds this rate; the client must know it too.
	PacketLimit *LimitConfig
	// contains filtered or unexported fields
}

Handler describes a call handler type that can be served over HTTP.

func (*Handler) ServeHTTP

func (ch *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LimitConfig

type LimitConfig struct {
	Burst int        `json:"b"`
	Rate  rate.Limit `json:"r"`
}

Jump to

Keyboard shortcuts

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