Features
- Raw WebSocket handlers: Use
onWebSocketfor low-level WebSocket control and custom protocols - Direct actor connections: Connect WebSocket clients directly to actor instances
- Connection management: Track WebSocket connections with state and broadcasting
- Real-time chat: Message broadcasting with user presence and chat history
- Persistent state: Messages and user data automatically saved in actor state
Implementation
This example demonstrates raw WebSocket handling for real-time chat:
- Actor Definition (
src/backend/registry.ts): UsesonWebSockethandler for low-level WebSocket protocol control
Resources
Read more about WebSockets, state, and events.



