Socket Connection
MeetStream provides real-time two-way WebSocket communication for controlling bots during meetings. This allows you to send messages and audio chunks to bots in real-time.Overview
When creating a bot, you can specify asocket_connection_url
field that accepts a WebSocket URL (wss://). Once the bot joins the meeting, it will establish a WebSocket connection to your server for real-time communication.
Connection Flow
- Bot Creation: Include
socket_connection_url
in your bot creation request - Bot Joins Meeting: Bot connects to your WebSocket server
- Ready Event: Bot sends a ready confirmation
- Real-time Commands: Send messages and audio chunks to the bot
Connection Events
Ready Event
When the bot successfully connects to your WebSocket server, it sends a ready confirmation:Commands
Send Chat Message
Send a text message to be displayed by the bot in the meeting:Send Audio Chunks
Send audio data to be played by the bot in the meeting:audiochunk
should be base64-encoded audio data.
Audio Implementation Example
Here’s a Python example showing how to send audio chunks from files:Bot Creation with Socket URL
When creating a bot, include thesocket_connection_url
field:
WebSocket Server Requirements
Your WebSocket server should:- Accept wss:// connections (secure WebSocket)
- Handle the ready event from the bot
- Process incoming commands (sendmsg, sendaudio)
- Send responses back to the bot
- Handle connection errors gracefully
Error Handling
- Connection failures: Bot will retry connection attempts
- Invalid commands: Bot will ignore malformed JSON or unknown commands
- Audio format errors: Bot will skip invalid audio chunks
- Network issues: Bot will attempt to reconnect automatically