Skip to content

Interface: RouteOptions ​

Defined in: server/gateway.ts:57

How routeToRoom finds rooms and decides who may connect.

Properties ​

PropertyTypeDescriptionDefined in
roomsRoomNamespaceDurable Object namespace of your Room class, e.g. env.ROOMS.server/gateway.ts:59
prefix?stringURL prefix rooms live under. Defaults to /rooms.server/gateway.ts:61

Methods ​

authenticate() ​

ts
authenticate(request, roomId): 
  | Response
  | Authenticated
| Promise<Response | Authenticated>;

Defined in: server/gateway.ts:69

Work out who is connecting. Return the player's id (or { id, name }), or a Response to refuse the connection. This is the only place identity is established: rooms trust whatever this returns. roomId is the room being opened. tokenAuth gives you one that checks signed join tokens, and Accounts.authenticate one that also knows signed-in players.

Parameters ​

ParameterType
requestRequest
roomIdstring

Returns ​

| Response | Authenticated | Promise<Response | Authenticated>

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