Dialogue Configuration
The main configuration object passed to createDialogue.
Full Configuration Example
Configuration Options
CORS Configuration
By default, Dialogue enables CORS for all origins, making it easy to develop with frontend and backend on different ports. CORS is applied to both HTTP requests (Socket.IO polling) and WebSocket connections.
CorsConfig Options:
Runtime Selection
Dialogue supports both Bun and Node.js runtimes via a runtime adapter pattern. By default, the runtime is auto-detected by checking for globalThis.Bun. You can override this with the runtime option.
Runtime behavior:
Both runtimes produce identical behavior from the client's perspective. The adapter pattern ensures all Dialogue features (rooms, events, hooks, CORS) work the same regardless of runtime.
DialogueContext
All authentication and event hooks receive a DialogueContext object providing global runtime awareness:
Example usage in hooks:
See Also
- Lifecycle Hooks - Configure hooks option
- Room Configuration - Configure rooms option
- Authentication - Auth setup and JWT