Struct WebSocketServerOptions

Struct Documentation

struct WebSocketServerOptions

Options for a WebSocket server.

Public Members

Context context

The logging context for this server.

std::string name

The name of the server.

std::string host = "127.0.0.1"

The host address of the server.

uint16_t port = 8765

The port of the server. Default is 8765, which matches the Foxglove app.

WebSocketServerCallbacks callbacks

The callbacks of the server.

WebSocketServerCapabilities capabilities = WebSocketServerCapabilities::None

The capabilities of the server.

std::vector<std::string> supported_encodings

The supported encodings of the server.

std::optional<std::string> session_id = std::nullopt

An optional session ID for the server.

This allows the client to understand if the connection is a re-connection or if it is connecting to a new server instance. This can for example be a timestamp or a UUID.

By default, the server will generate a session ID based on the current time.

FetchAssetHandler fetch_asset

A fetch asset handler callback.

SinkChannelFilterFn sink_channel_filter

A sink channel filter callback.

ParameterHandler parameter_handler

A parameter handler.

When set, this handler takes precedence over the deprecated onGetParameters / onSetParameters callbacks. Registering a handler also automatically advertises the Parameters capability. Subscribe / unsubscribe notifications still go through the onParametersSubscribe / onParametersUnsubscribe callbacks on WebSocketServerCallbacks; wire those up separately if you want to be notified.

Both ParameterHandler::onGet and ParameterHandler::onSet are required when a handler is supplied; setting only one returns FoxgloveError::ValueError from WebSocketServer::create.

std::optional<TlsIdentity> tls_identity = std::nullopt

(internal) TLS configuration for the server.

This option is under active development and may change.

std::optional<std::pair<uint64_t, uint64_t>> playback_time_range = std::nullopt

The time range for playback. This applies if the server is playing back a fixed time range of data.

Note

Setting this option implies the PlaybackControl capability

std::optional<size_t> message_backlog_size = std::nullopt

Override the message backlog size.

The server buffers outgoing log entries into a queue per connected client. If the backlog size is exceeded, the oldest entries are dropped. Control-plane messages use a separate queue of the same size; if that queue fills, the slow client is disconnected.

By default, the server buffers 1024 messages per client.

Friends

friend class WebSocketServer