Chat Room

Chat Room

Example project demonstrating real-time messaging and actor state management.

Features

  • Real-time messaging: Broadcast messages to all connected clients instantly
  • Persistent chat history: Messages automatically saved in actor state across restarts
  • Multiple chat rooms: Each room is a separate actor instance with isolated state
  • Event-driven architecture: Use actor events to push updates to clients in real-time

Implementation

The chat room demonstrates core Rivet Actor patterns for real-time communication:

  • Actor Definition (src/backend/registry.ts): Defines the chatRoom actor with message history state and actions for sending messages and retrieving history

Resources

Read more about actions, state, and events.