WebSocket requires Pro or Enterprise tier.
Endpoint
wss://polychadsbot.xyz/ws/alerts?api_key=YOUR_KEY
Example
const ws = new WebSocket(
"wss://polychadsbot.xyz/ws/alerts?api_key=YOUR_KEY"
);
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
switch (msg.type) {
case "connected":
console.log("Connected —", msg.tier, "tier");
break;
case "alert":
const a = msg.data;
console.log(`${a.side} ${a.outcome} @ ${a.entry_price}`);
console.log(`$${a.usdc_value} | score ${a.signal_score}`);
console.log(a.event_title);
break;
}
};
// Required — send ping every 25s to stay connected
setInterval(() => {
if (ws.readyState === WebSocket.OPEN) ws.send("ping");
}, 25000);
Messages
connected
Sent once when you connect.
{
"type": "connected",
"message": "Connected to Polychads alert stream",
"tier": "pro"
}
alert
New insider alert detected. data is the full Alert object.
{
"type": "alert",
"data": {
"id": 2221,
"alert_type": "fresh",
"side": "BUY",
"outcome": "Yes",
"entry_price": 0.42,
"usdc_value": 2100.0,
"signal_score": 72,
"event_title": "Will ETH hit $5000 by April?",
"category": "crypto"
}
}
pong
Response to your ping. Server closes connections that don’t ping within 30 seconds.
Reconnection
If you get disconnected, back off exponentially:
let delay = 1000;
function connect() {
const ws = new WebSocket("wss://polychadsbot.xyz/ws/alerts?api_key=KEY");
ws.onopen = () => { delay = 1000; };
ws.onclose = () => {
setTimeout(connect, delay);
delay = Math.min(delay * 2, 30000);
};
}
The key goes in the query string (api_key=), not the Authorization header. WebSocket headers aren’t universally supported.