interface RoomMembershipListener
Since 0.2.0

Notified whenever a connection joins or leaves a Room.

A RoomRegistry supplies one to every room it creates so it can maintain a reverse connection → rooms index. Membership changes are the only way that index can be kept accurate, because application code holds the WebSocketRoom directly (ws.room('lobby').add(conn)) and never goes back through the registry to join.

Methods

Called when a connection is added to a room it was not already in.

Called when a connection is removed from a room it was in — whether by an explicit Room.remove or by being dropped mid-broadcast.

Usage

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