websocketfanout

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package websocketfanout provides a WebSocket presentation fanout adapter for runtime/contracts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub fans presentation events out to connected WebSocket clients.

func New

func New(options ...Option) *Hub

New creates a WebSocket fanout hub.

func (*Hub) ClientCount

func (hub *Hub) ClientCount() int

ClientCount returns the number of currently connected clients.

func (*Hub) SendPresentationEvents

func (hub *Hub) SendPresentationEvents(ctx context.Context, events []contracts.EventEnvelope) error

SendPresentationEvents broadcasts presentation events to connected clients. Non-presentation events are ignored.

func (*Hub) ServeHTTP

func (hub *Hub) ServeHTTP(response http.ResponseWriter, request *http.Request)

ServeHTTP upgrades one browser connection and streams presentation events.

type Option

type Option func(*Hub)

Option configures a Hub.

func WithAcceptOptions

func WithAcceptOptions(options websocket.AcceptOptions) Option

WithAcceptOptions sets the options used for WebSocket upgrades.

func WithBufferSize

func WithBufferSize(size int) Option

WithBufferSize sets each client's queued message buffer. Non-positive values keep the default.

Jump to

Keyboard shortcuts

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