WebSocket Streaming
DeveloperReceive filing alerts in real time over a persistent WebSocket connection. No polling required — filings are pushed to your client the instant they're processed.
Connection
wss://ws.8kintel.comconst ws = new WebSocket("wss://ws.8kintel.com?token=YOUR_API_KEY");
ws.onopen = () => {
console.log("Connected to 8K Intel WebSocket");
};
ws.onmessage = (event) => {
const alert = JSON.parse(event.data);
console.log(`[${alert.ticker}] ${alert.headline}`);
};
ws.onclose = () => {
console.log("Disconnected — reconnecting in 5s...");
setTimeout(connect, 5000);
};import asyncio
import websockets
import json
async def listen():
uri = "wss://ws.8kintel.com?token=YOUR_API_KEY"
async with websockets.connect(uri) as ws:
async for message in ws:
alert = json.loads(message)
print(f"[{alert['ticker']}] {alert['headline']}")
asyncio.run(listen())Message Format
All messages are JSON objects with a type field. Currently the only message type is filing_alert.
{
"type": "filing_alert",
"filing_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"ticker": "AAPL",
"sentiment": "bullish",
"headline": "Q1 2026 revenue beats estimates by 8%, services hit all-time high",
"title": "AAPL — Earnings",
"body": "Revenue $124.3B vs $115.2B est. Services segment hits all-time high."
}| Field | Type | Description |
|---|---|---|
| type | string | Always "filing_alert" |
| filing_id | string | UUID — use to fetch full detail via REST API |
| ticker | string | Stock ticker symbol |
| sentiment | string | bullish, bearish, or neutral |
| headline | string | AI-generated one-line summary |
| title | string | Push notification title (TICKER — Category) |
| body | string | Push notification body text |
Connection Lifecycle
Connection
Connections are authenticated on connect via the token query parameter. Invalid or expired tokens receive a 4401 close code.
Keep-Alive
The server sends periodic ping frames. Connections idle for more than 10 minutes without a pong response are terminated.
Reconnection
Implement exponential backoff on disconnect. We recommend starting at 1 second and capping at 30 seconds. The connection store has a 24-hour TTL — reconnect before then.
Limits
Developer plans: 1 concurrent connection. Pro plans: up to 5 concurrent connections. Exceeding the limit closes the oldest connection.
Best Practices
- •Use the
filing_idto fetch full detail viaGET /api/v1/filings/{id}— the WebSocket payload is a lightweight alert, not the full filing. - •Implement automatic reconnection with backoff. Network interruptions are normal.
- •Buffer messages during reconnection and deduplicate by
filing_idwhen you reconnect. - •For high-reliability use cases, combine WebSocket with webhooks as a fallback delivery channel.