wsproto

package
v0.6.123 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 18 Imported by: 1 module, 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 wsproto serves services over ws-proto (protobuf RPC over WebSocket) as a managed public api: gRPC services, with the same register function as Service.GRPC so one implementation serves both, or handlers generated for ws-proto itself. Every call is traced and a panicking one ends with codes.Internal, like on the gRPC server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve[St any, R Register](
	svc *backplane.Service[St], prefix string, origins api.Origins, register R, opts ...api.WSProtoOption,
)

Serve mounts a ws-proto endpoint at prefix on a public port of svc and announces it with the registered services' descriptors. origins is the browser origin policy: the zero value admits same-origin browsers and non-browser clients only.

api.Middleware wraps the endpoint once per connection: the connection's context is the one it passes on (see api.Middleware). api.CallMiddleware wraps every call; api.Interceptors and api.StreamInterceptors wrap the calls of gRPC-registered services only. api.Keepalive tunes pings.

Types

type Register added in v0.6.46

type Register interface {
	func(grpc.ServiceRegistrar) | func(*wsrpc.Server)
}

Register is what Serve registers the endpoint's services with: the register function of Service.GRPC, or one that registers ws-proto generated handlers (Register<Service>Handler) on the endpoint's server.

Jump to

Keyboard shortcuts

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