WebSockets
Real-time data streaming via WebSocket connections. Subscribe to channels, and data flows as it happens on-chain — sub-second from transaction to your application.
Connecting
wss://api.conyr.ai/wsJavaScript
const ws = new WebSocket("wss://api.conyr.ai/ws");
ws.onopen = () => {
ws.send(JSON.stringify({
op: "subscribe",
channels: ["token:EPjFWd...:trades"]
}));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.channel) {
console.log(`[${msg.channel}]`, msg.data);
}
};Python
import asyncio
import json
import websockets
async def stream():
async with websockets.connect("wss://api.conyr.ai/ws") as ws:
await ws.send(json.dumps({
"op": "subscribe",
"channels": [
"token:EPjFWd...:trades",
"token:EPjFWd...:ohlcv:full:1m",
]
}))
async for message in ws:
data = json.loads(message)
if "channel" in data:
print(f"[{data['channel']}] {data['data']}")
asyncio.run(stream())Client → Server Messages
Subscribe
{"op": "subscribe", "channels": ["token:EPjFWd...:trades", "wallet:7xKXtg...:pnl"]}Subscribe to multiple channels in a single message.
Unsubscribe
{"op": "unsubscribe", "channels": ["token:EPjFWd...:trades"]}Ping
{"op": "ping"}The server also sends WebSocket-level pings every 30 seconds to keep the connection alive.
Server → Client Messages
Subscription Confirmed
{"op": "subscribed", "channels": ["token:EPjFWd...:trades"]}Data Event
{"channel": "token:EPjFWd...:trades", "data": { ... }}The data payload depends on the channel type.
Pong
{"op": "pong"}Error
{"op": "error", "message": "Subscription limit reached (max 50)"}Errors are informational — they don’t disconnect you.
Available Channels
Layer 1 — Market Data
| Channel Pattern | Description |
|---|---|
token:{mint}:trades | Every swap as it happens |
token:{mint}:ticks | Chart tick price updates |
token:{mint}:ohlcv:{view}:{tf} | Candle updates |
OHLCV parameters:
- view:
fullorfiltered - tf (timeframe):
1s,1m,5m,15m,1h - Example:
token:EPjFWd...:ohlcv:filtered:5m
Layer 2 — Wallet Intelligence
| Channel Pattern | Description |
|---|---|
wallet:{addr}:pnl | Realized PnL on every sell |
wallet:{addr}:positions | Position deltas (open/close/partial) |
wallet:{addr}:labels | Enriched label updates (45+ fields) |
Layer 3 — Security Intelligence
| Channel Pattern | Description |
|---|---|
token:{mint}:security | Token security events |
wallet:{addr}:security | Wallet security events |
Limits by Tier
| Tier | Connections | Subscriptions / Connection |
|---|---|---|
| Free | 0 | 0 |
| Layer 1 | 5 | 50 |
| Layer 2 | 20 | 50 |
| Layer 3 | 50 | 50 |
| Enterprise | Unlimited | Unlimited |
Backpressure Behavior
If your client falls behind, messages are dropped silently rather than creating backpressure that affects other consumers. Make sure your message handler is fast. If you need guaranteed delivery, use the Enterprise tier.