Event Definitions
Events are defined using the defineEvent function. Each event has a unique name and optional schema validation.
Basic Event Definition
Events with Schema Validation
Use Zod schemas to validate event payloads at runtime:
Event Definition Options
Type Inference
Event types are automatically inferred from the schema:
See Also
- Room Configuration - Using events in rooms
- Lifecycle Hooks - Event middleware and hooks
- TypeScript Types - EventDefinition interface