method RoomRegistry.prototype.peek
Since 0.4.0
RoomRegistry.prototype.peek(name: string): Room | undefined

Returns the named room if one already exists, without creating it.

The non-allocating counterpart to RoomRegistry.get. It is a bare map read by design: it must not touch RoomRegistry.#neverJoined in either direction, because adding to that set would mark a room already in use as abandoned, and reclaiming from it on a read path would make a lookup that promises to change nothing dispose rooms.

Parameters

name: string

Room name

Return Type

Room | undefined

The room, or undefined when no room of that name exists

Usage

import { RoomRegistry } from "websocket-plugin/src/index.ts";