ws

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Code generated by apic; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")

ErrNotImplemented is returned by UnimplementedWSServer methods.

Functions

func RegisterGeneratedWS

func RegisterGeneratedWS(mux *http.ServeMux, srv WSServerInterface, opts WSOptions)

RegisterGeneratedWS registers WebSocket endpoints; srv handles business logic.

GAP-0076: when the configuration declares at least one WebSocket endpoint with auth: "jwt" but the caller supplied a nil opts.AuthJWT, this function panics with a fmt.Errorf wrapping securex.ErrAuthVerifierRequired BEFORE any endpoint is registered. The same guard fires for auth: "api_key" + nil opts.Auth via securex.ErrAuthAPIKeyRequired. Use securex.NewTestVerifier() as the unit-test escape hatch.

func WithWSLimiter

func WithWSLimiter(opts *WSOptions, path string, lim *wsx.Limiter)

WithWSLimiter installs a custom *wsx.Limiter for a single path. Pass to the caller's option-builder when assembling WSOptions. The override survives ws.go.tmpl regeneration: a consumer that wires a Redis-backed cap need not patch the template. GAP-0075.

Types

type UnimplementedWSServer

type UnimplementedWSServer struct{}

UnimplementedWSServer returns ErrNotImplemented for every WebSocket endpoint.

func (UnimplementedWSServer) Items

func (UnimplementedWSServer) Items(conn *wsx.Conn) error

type WSOptions

type WSOptions struct {
	Auth    func(*http.Request) error
	AuthJWT func(*http.Request) error
	// Limiters is an optional per-path override of the auto-built
	// process-local *wsx.Limiter. Use to wire e.g. a Redis-backed
	// limiter for cross-pod accounting. A path not present in the map
	// gets the auto-built limiter. GAP-0075.
	Limiters map[string]*wsx.Limiter
}

WSOptions configures cross-cutting concerns for WebSocket endpoints.

type WSServerInterface

type WSServerInterface interface {
	Items(conn *wsx.Conn) error
}

WSServerInterface defines the business logic contract for generated WebSocket endpoints. Embed UnimplementedWSServer and override only the endpoints you need.

Jump to

Keyboard shortcuts

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