API Reference
WebSocket API
Real-time streaming with WebSockets
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Real-time streaming with WebSockets
const ws = new WebSocket('wss://ws.superatom.ai/v1');
ws.onopen = () => {
ws.send(JSON.stringify({
type: 'auth',
token: 'YOUR_API_KEY'
}));
};
{
"type": "query",
"id": "msg_123",
"content": "Show me sales by region"
}
{
"type": "chunk",
"id": "msg_123",
"content": "Here are the sales..."
}
{
"type": "complete",
"id": "msg_123",
"visualization": { ... }
}
ws.onclose = () => {
setTimeout(reconnect, 1000 * Math.pow(2, attempts));
};
{ "type": "ping" }