Skip to content

roomEndpoint

function roomEndpoint(room): string;

Defined in: relay-sdks/ts/src/room-endpoint.ts:65

Root an endpoint at a room. The result is the endpoint with each room field appended to its path, after any path it has and without its trailing slashes, and with its query kept, a jwt parameter included. A connection to it names namespaces relative to the room. Without an endpoint it roots DEFAULT_ENDPOINT:

roomEndpoint(['acme', 'rooms', '42']);
// 'https://relay.mux.global/acme/rooms/42'
roomEndpoint('https://relay.example', ['acme', 'rooms', '42']);
// 'https://relay.example/acme/rooms/42'

The endpoint follows the connect calls’ rules and the room the namespace rules. Nothing is percent-encoded: a room field holds only A–Z, a–z, 0–9 and -._~!$&'()+,;=:@, and is not . or ... A namespace with any other field is reached from the bare host instead.

Parameter Type
room readonly string[]

string

An endpoint that is not an absolute URL string, or a room that is not a sequence of non-empty string fields.

An endpoint that is not https, has a fragment or userinfo, or an empty jwt; a room of more than 32 fields; a room field with any other character, or . or ...

function roomEndpoint(endpoint, room): string;

Defined in: relay-sdks/ts/src/room-endpoint.ts:66

Root an endpoint at a room. The result is the endpoint with each room field appended to its path, after any path it has and without its trailing slashes, and with its query kept, a jwt parameter included. A connection to it names namespaces relative to the room. Without an endpoint it roots DEFAULT_ENDPOINT:

roomEndpoint(['acme', 'rooms', '42']);
// 'https://relay.mux.global/acme/rooms/42'
roomEndpoint('https://relay.example', ['acme', 'rooms', '42']);
// 'https://relay.example/acme/rooms/42'

The endpoint follows the connect calls’ rules and the room the namespace rules. Nothing is percent-encoded: a room field holds only A–Z, a–z, 0–9 and -._~!$&'()+,;=:@, and is not . or ... A namespace with any other field is reached from the bare host instead.

Parameter Type
endpoint string
room readonly string[]

string

An endpoint that is not an absolute URL string, or a room that is not a sequence of non-empty string fields.

An endpoint that is not https, has a fragment or userinfo, or an empty jwt; a room of more than 32 fields; a room field with any other character, or . or ...