REST & RealtimeWebSockets

WebSockets

Thirteen real-time channel families for agent observation loops. Subscribe after a REST or MCP snapshot, then reconcile periodically because this transport favors low latency over replay guarantees.

Connecting

wss://api.conyr.ai/ws

Requires Authorization: Bearer <key>. The Free tier is rejected — /ws is a paid feature.

import WebSocket from "ws";
 
const ws = new WebSocket("wss://api.conyr.ai/ws", {
  headers: { Authorization: "Bearer YOUR_API_KEY" },
});
 
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 PatternDescription
token:{mint}:tradesEvery swap as it happens
token:{mint}:ticksChart tick price updates
token:{mint}:ohlcv:{view}:{tf}Candle updates

OHLCV parameters:

  • view: full or filtered
  • tf (timeframe): 1s, 1m, 5m, 15m, 1h
  • Example: token:EPjFWd...:ohlcv:filtered:5m

Layer 2 — Wallet Intelligence

Channel PatternDescription
wallet:{addr}:pnlRealized PnL on every sell
wallet:{addr}:positionsPosition deltas (open/close/partial)
wallet:{addr}:labelsEnriched label updates (45+ fields)

Layer 3 — Security Intelligence

Channel PatternDescription
token:{mint}:securityToken security events
token:{mint}:bundlesRaw BundleV2 per-token updates
token:{mint}:dump_alertCompact coordinated-dump alerts
wallet:{addr}:securityWallet security events
wallet:{addr}:followFollow-edge activations, updates, and expirations involving the address
wallet:{addr}:entityEntity-membership changes for the address
token:{mint}:campaignCoordinated 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

TierConnectionsSubscriptions / Connection
Free00
Layer 1550
Layer 22050
Layer 35050
EnterpriseUnlimitedUnlimited

Backpressure Behavior

⚠️

If your agent falls behind, messages are dropped silently rather than creating backpressure that affects other consumers. Keep the handler fast and repair state from REST. The public WebSocket contract does not provide replay or guaranteed delivery on any tier.