Basic Usage
Emit events to a specific channel:route.ts
page.tsx
Channel Patterns
User-Specific Channels
User-Specific Channels
Send notifications to individual users:
route.ts
page.tsx
Room-Based Channels
Room-Based Channels
Broadcast to all users in a room:
route.ts
Team Workspaces
Team Workspaces
Scope events to team workspaces:
route.ts
Dynamic Channels
Switch channels dynamically based on user navigation:page.tsx
Broadcasting to Multiple Channels
Emit to multiple channels simultaneously:route.ts
Channel Security
Combine channels with middleware for secure access control:app/api/realtime/route.ts
Authenticate Realtime Requests
See the middleware documentation for authentication examples