Overview
Yes. The WebSocket API provides real-time bidirectional communication for messaging, streaming responses, and presence indicators. Connect to:
wss://api.dyva.ai/v1/ws
Authentication
Authenticate during the initial WebSocket handshake by including your API key as a query parameter:
wss://api.dyva.ai/v1/ws?token=rk_your_api_key
The server validates your key and returns a connected event on success or closes the connection with an error code on failure.
Event Types
The WebSocket connection supports these event types:
message.created: a new message was sent (by you or the character)message.streaming: character response tokens arriving in real-timemessage.completed: the character finished generating its responsetyping.start/typing.stop: typing indicatorsconversation.updated: conversation metadata changederror: something went wrong (includes error code and message)
Use Cases
- Chat interfaces: build real-time chat UIs that show streaming responses as the character generates them
- Live dashboards: monitor conversation activity across multiple characters in real-time
- Bots and automations: respond to messages programmatically as they arrive
Connection Limits
- Pro: 50 concurrent WebSocket connections
- Creator: 100 concurrent WebSocket connections
Connections idle for more than 5 minutes without any message exchange are automatically closed. Send periodic ping frames to keep the connection alive.
Full protocol documentation is in Build.