Overview
The Vibing AI Event System uses WebSockets for real-time communication, with HTTP-based subscription management and event publication. It supports various event types across different channels for a comprehensive eventing solution.WebSocket Connection
Connection Endpoint
Connection Parameters
token: A valid access token with appropriate permissionschannels: Comma-separated list of channels to subscribe toclient_id: Unique identifier for the client connection
Event Types
The event system supports a diverse set of event types across different channels:Conversation Events
message.new- New message in conversationmessage.updated- Message content updatedconversation.created- New conversation createdconversation.updated- Conversation metadata changedtyping.start- User/agent started typingtyping.stop- User/agent stopped typing
Memory Events
memory.created- New memory item createdmemory.updated- Memory item updatedmemory.deleted- Memory item deletedmemory.embedding_complete- Embedding generation completed
Offering Events
offering.installed- New offering installedoffering.uninstalled- Offering uninstalledoffering.updated- Offering updatedoffering.status_change- Offering status changed
System Events
system.notification- System notificationsystem.status- System status updatesystem.maintenance- Maintenance notification
Event Message Format
All events follow a standardized format:id: Unique event identifiertype: Event type (e.g.,message.new)channel: Event channel (e.g.,conversation)timestamp: Event creation time in ISO 8601 formatdata: Event-specific payload (varies by event type)
REST API Endpoints
Besides WebSocket connections, the event system provides REST API endpoints for various operations.Publishing Events
Endpoint:POST /api/events/publish
Authentication Required: Yes
Request:
Managing Subscriptions
Endpoint:POST /api/events/subscriptions
Authentication Required: Yes
Request:
Listing Subscriptions
Endpoint:GET /api/events/subscriptions
Authentication Required: Yes
Response:
Deleting a Subscription
Endpoint:DELETE /api/events/subscriptions/:subscription_id
Authentication Required: Yes
Response:
SDK Integration
The Vibing AI SDK provides simple methods for working with the Event System:React Hook Integration
For React applications, the SDK provides a convenient hook:Webhook Integration
When using webhooks for event delivery, your server should handle POST requests with the following format:Best Practices
- Efficient Event Handling: Process events asynchronously and quickly to avoid blocking the event loop
- Reconnection Logic: Implement proper reconnection with backoff for WebSocket connections
- Targeted Subscriptions: Subscribe only to events you need to reduce network traffic
- Filter Usage: Use filters to narrow down events based on context
- Error Handling: Implement robust error handling for network issues and malformed events
- Connection Cleanup: Always disconnect WebSocket connections when no longer needed
- Idempotent Processing: Process events idempotently to handle potential duplicates
Rate Limits
- WebSocket connections: 10 concurrent connections per user
- Event publication: 20 events per minute per user
- Subscription creation: 10 per hour per user
- Event delivery: 100 events per minute per subscription
Security Considerations
- Token Security: Protect access tokens used for WebSocket connections
- Webhook Authentication: Verify webhook requests using signature verification
- Event Validation: Validate event data before processing
- Connection Monitoring: Monitor for unusual connection patterns
- Secure URLs: Use HTTPS for webhook URLs
- Data Minimization: Only send necessary data in events
AsyncAPI Documentation
The complete Event System is documented using AsyncAPI 2.6, which provides detailed schema information for all events. The AsyncAPI specification is available at/api-reference/asyncapi.json.
Next Steps
- Memory API - Learn how to use memory events
- Authentication - Understand event authentication
- SDK Overview - Explore the SDK for Events integration