Skip to main content

WebSocket Rooms

When your real-time app needs more than a single broadcast channel — chat rooms, game lobbies, collaborative editing — PrismRoom and PrismRoomManager provide the structure.

Core Concepts

  • Room: A named channel that holds connections and can broadcast messages to all members
  • Room Manager: Creates, retrieves, and cleans up rooms
  • Presence: Tracks who’s in each room with custom metadata (name, avatar, status)

Room Manager

Managing Rooms

Joining and Leaving

Room-Aware WebSocket Handler

Presence Tracking

Track who’s in each room with metadata:
Presence Example

Multi-Room Chat App

Complete Multi-Room Chat
Empty rooms are automatically cleaned up by PrismRoomManager when the last connection leaves. No manual cleanup needed.