WebSocket Delivery
Connect to the ScrapeBadger WebSocket endpoint to receive real-time tweet events from all your active stream monitors and filter rules.Connection
Using wscat
Using Python
Using Node.js
Event format
Each WebSocket message is a JSON object:Connection behavior
- Authentication is done via the
api_keyquery parameter - Heartbeat pings are sent every 30 seconds to keep the connection alive
- Auto-reconnect is recommended in your client code — the server may close idle connections
- All monitors and filter rules for the API key deliver to the same WebSocket connection
- Multiple connections are supported per API key
Best practices
- Always implement reconnection logic with exponential backoff
- Process messages asynchronously to avoid blocking the WebSocket receive loop
- Use webhooks as a backup — WebSocket connections can drop, but webhooks retry delivery

