Skip to content

Interface: RelayServerOptions

@roomful/relay


@roomful/relay / RelayServerOptions

Defined in: packages/relay/src/server.ts:172

Configures the public relay server.

optional authorize: (context) => boolean | void | Promise<boolean | void>

Defined in: packages/relay/src/server.ts:191

Runs custom authorization before accepting a peer.

RelayAuthorizeContext

boolean | void | Promise<boolean | void>


optional authSecret: string

Defined in: packages/relay/src/server.ts:220

Enables built-in JWT authorization. When set, peers must present a valid HS256 token signed with this secret unless a custom authorize/auth() handler is configured.


optional corsOrigin: string

Defined in: packages/relay/src/server.ts:213

Restricts browser access by allowed origin. When set, HTTP responses carry matching CORS headers and WebSocket upgrades from other browser origins are rejected. Use '*' to allow any origin.


optional host: string

Defined in: packages/relay/src/server.ts:181

Selects the listening host.


optional managementApi: object

Defined in: packages/relay/src/server.ts:248

Enables the management REST API at the given path prefix. When set, the relay serves project/room/quota CRUD endpoints at the specified prefix (e.g. /api/v1). Requires a store and default quota values.

Example:

managementApi: {
prefix: '/api/v1',
defaults: { maxRooms: 100, maxPeersPerRoom: 250, ... },
}

defaults: RelayDefaults

optional prefix: string

optional store: ManagementStore


optional maxConnections: number

Defined in: packages/relay/src/server.ts:186

Caps concurrent peer connections.


optional maxRooms: number

Defined in: packages/relay/src/server.ts:226

Caps the number of distinct rooms this relay instance will host. A join that would open a new room beyond the cap is rejected with a ROOM_LIMIT error. Enforced per relay instance.


optional maxRoomSize: number

Defined in: packages/relay/src/server.ts:206

Caps the number of peers allowed in any single room. Applied as a hard ceiling on top of the client-provided maxPeers.


optional messageRateLimit: RelayMessageRateLimit

Defined in: packages/relay/src/server.ts:232

Limits how many messages a single peer connection may send. Excess messages are rejected with a RATE_LIMITED error instead of being processed. Off by default.


port: number

Defined in: packages/relay/src/server.ts:176

Selects the listening port.


optional redisUrl: string

Defined in: packages/relay/src/server.ts:200

Experimental

Enables Redis coordination across relay instances.

Multi-instance/Redis coordination is experimental. Its semantics (e.g. rejecting joins while Redis is unavailable) may change before being declared stable.