Examples
Common usage patterns and recipes for Verani.
Architecture
Verani uses a per-connection architecture where each user gets their own Durable Object (ConnectionDO). RoomDOs coordinate membership and broadcasting via RPC.
Use createConnectionHandler() and createRoomHandler() for this pattern.
Authentication Note
Examples marked with:
- Public - No authentication required (anyone can connect)
- Authenticated - Requires token verification
- Authorized - Requires authentication + role/permission checks
For production apps, always use authenticated examples. See Security Guide - Authentication for implementation details.
Examples
- Basic Chat Room - Simple chat room example
- Socket.io-like API - Event handlers and emit API
- Channels - Custom WebSocket paths and multiple channels
- User Presence - Track who is online
- State Persistence - Persist room state across hibernation
- Authentication - JWT token verification
- Rate Limiting - Prevent spam with rate limits
- RPC - Send messages via Remote Procedure Calls
Related Documentation
- Quick Start Guide - Step-by-step tutorial
- API Reference - Complete API documentation
- Security Guide - Authentication and security