Skip to content

Function: routeToRoom() ​

ts
function routeToRoom(request, options): Promise<Response | null>;

Defined in: server/gateway.ts:79

Forwards room traffic to the room's Durable Object: WebSocket upgrades on {prefix}/{roomId}, and plain HTTP requests on {prefix}/{roomId}/..., which reach the room's onHttp hook. Both are authenticated first. Returns null when the URL is not a room URL, so the caller can fall through to its other routes.

Parameters ​

ParameterType
requestRequest
optionsRouteOptions

Returns ​

Promise<Response | null>

MIT licence. Tickflare is an independent project and is not affiliated with Cloudflare.