API ReferenceWebSockets

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/ws

JavaScript

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 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
wallet:{addr}:securityWallet security events

Limits by Tier

TierConnectionsSubscriptions / Connection
Free00
Layer 1550
Layer 22050
Layer 35050
EnterpriseUnlimitedUnlimited

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.