OptionalallowedAllowlist of Origin header values that may connect (CSWSH defense for
browser clients). A connection whose Origin is not listed is closed with
CloseCode.PolicyViolation. Omit to allow any origin (non-browser
clients typically send no Origin, which is always allowed).
OptionalauditSink for AuditEvents covering peer and room lifecycle transitions.
OptionalauthToken verification hook. When omitted, connections are admitted using whatever identity the transport supplies — do not omit in production. See AuthFunction.
OptionalclusterEnables cluster mode. When set, the server constructs a RoomRouter and routes each room to its owning node; connections for rooms owned by another node are redirected. See RoomRouter for the sharding flow.
Live roster of cluster nodes used to build the hash ring.
Stable id of this node within the cluster.
OptionaliceHook to supply per-connection ICE servers (e.g. short-lived TURN
credentials) sent to the joining peer. Return null/undefined to omit
ICE servers for that peer. May be async.
Id of the joining peer.
Id of the room being joined.
The ICE servers to advertise, or nothing.
OptionalloggerStructured log sink.
OptionalmaxHard cap on total concurrent connections across all rooms. Connections beyond the cap are closed with CloseReason.ServerAtCapacity.
OptionalmaxMaximum inbound WebSocket message size in bytes; larger frames are
rejected by ws before reaching application code. Blunts memory-exhaustion
floods.
OptionalmaxHard cap on concurrent peers per room; excess peers are closed with CloseReason.RoomFull. Bounded out of the box; raise it for larger rooms.
OptionalmaxHard cap on the number of concurrent rooms. A connection that would create a new room past this cap is rejected.
OptionalmetricsMetrics sink.
OptionalonCalled when an incoming connection targets a room owned by another node, just before the connection is closed with CloseReason.WrongNode. Use it to inform the client (or a load balancer) of the correct owner.
OptionalpingInterval in milliseconds between heartbeat pings sent to each peer.
OptionalpongGrace period in milliseconds after which a peer that has not ponged is pruned.
OptionalportTCP port to listen on when the server creates its own HTTP server.
OptionalratePer-peer inbound rate limiting. Enabled by default at 100 msg/s; set
maxMessagesPerSecond to 0 (or a negative value) to disable.
OptionalmaxMessagesPerSecond?: numberMaximum inbound messages per second per peer; excess messages are
dropped and PeerEvent.RateLimitExceeded fires. 0 or negative
disables the limiter.
OptionalroomIdle timeout in milliseconds; a room with no relay/broadcast activity for this long is closed.
OptionalroomMaximum lifetime of a room in milliseconds; on expiry all peers are disconnected and the room closes.
OptionalserverExisting Node HTTP server to attach the WebSocket server to instead of creating one. Takes precedence over SignalingServerOptions.port.
OptionalserverWhen true, the server assigns each peer's id rather than trusting the client-supplied id.
Configuration for a SignalingServer. Every field is optional; an empty object yields an unauthenticated server listening on port 3000 with default heartbeat timings.
Remarks
For production deployments you will almost always set SignalingServerOptions.auth. See SignalingServerOptions.cluster to enable horizontal sharding via RoomRouter.