Pub/Sub
Pub/Sub
Connect your agents to real-time messaging at global scale. Pub/Sub enables instant communication between agents, users, and services through durable message channels that scale from one to millions of concurrent connections.
Key Features
- Durable Connections: WebSocket connections that survive network interruptions
- Global Distribution: Sub-20ms message delivery worldwide
- Automatic Scaling: Handle millions of concurrent connections
- Message Ordering: Guaranteed order within channels
- Presence Detection: Track who's online in real-time
TypeScript API
typescript
Agent Examples
Real-Time Collaboration Agent
typescript
Live Chat Support Agent
typescript
Live Streaming Agent
typescript
Gaming Matchmaking Agent
typescript
Best Practices
Connection Management
typescript
Message Filtering
typescript
Channel Organization
typescript
Limitations & Considerations
- Message Size: Maximum 1MB per message
- Channel Limits: 1,000 channels per WebSocket connection
- Connection Duration: 24 hours maximum per connection
- Message Rate: 1,000 messages per second per channel
- Presence Updates: Updated every 30 seconds
Related Services
- Memory Store (KV) - Store session state and user preferences
- Queues - Handle message processing pipelines
- Analytics Storage - Track messaging patterns and engagement