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/wsRequires Authorization: Bearer <key>. The Free tier is rejected — /ws is a paid feature.
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);
}
};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"]}Unsubscription Confirmed
{"op": "unsubscribed", "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)"}Subscription and message errors are informational — they don’t disconnect you. Subscribing to a channel above your key’s tier returns a non-fatal op:error naming the required tier (e.g. Channel '...' requires Layer N tier; your key is ...); the connection stays open and your other subscriptions in the same batch still succeed.
Connection-level rejections do terminate the connection: a Free-tier upgrade is refused with HTTP 403, and exceeding the per-key connection cap closes the socket with WebSocket close code 1008.
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 |
wallet:{addr}:follow | Follow-edge activations, updates, and expirations involving the address |
wallet:{addr}:entity | Entity-membership changes for the address |
token:{mint}:campaign | Coordinated campaign activations, updates, and closes on the token |
The three coordination channels stream the same primitives served by the REST Coordination endpoints. If they appear silent, fall back to REST and check GET /v1/coordination/health.
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.