OptionalmaxOptionalonNotification when the connection state changes.
OptionalonOptional debug hook — pairs nicely with createDebugLogger('hiyve:semantic-relay').
OptionalonConnection-level error callback.
OptionalpruneNumber of dedupe entries to drop when the cache is pruned. Default 50.
OptionalretryOverride the connect-retry policy. Defaults to three attempts with
200ms / 800ms / 2000ms backoff. Auth failures (401/403 from the
handshake) are not retried regardless of this setting. In 'auto'
transport mode the ladder applies to the WebSocket fallback attempts;
WebTransport gets a single attempt before falling through (a
WebTransport connect failure is almost always environmental — blocked
UDP — and retrying it only delays a transport that will work).
Room identifier — relay-side scope for broadcasts.
OptionalserverCert hashes for the browser WebTransport serverCertificateHashes
option. Only needed when the relay serves a self-signed certificate
(e.g. localhost development). Deployed relays serve a CA-trusted
certificate, which passes ordinary browser validation — leave this
unset (an empty array is treated as "no pinning").
HMAC-SHA256 JWT minted by the app backend.
OptionaltransportTransport selection policy. Default 'auto'.
WebTransport URL — must use the https:// scheme (HTTP/3). The relay
adds query parameters for room and token, so callers should pass the
raw base path, e.g. https://semantic.hiyve.tv:4443/relay.
Identifier the consumer treats as authoritative. Duplicated into every
published envelope so subscribers can attribute messages without waiting
for a peer-presence stream from the server. Should match the JWT's
userId claim — the SDK does not enforce this, but mismatches lead to
confusing attribution.
OptionalwsCongestion threshold (bytes) for the WebSocket fallback: while the
socket's bufferedAmount exceeds this, outbound messages coalesce
latest-wins per topic. Default 16 KB. Ignored on WebTransport.
Maximum dedupe entries per topic before pruning kicks in. Default 200.