Coin Listing Docs
Telegram ↗

Examples

Production-ready Python and Node.js clients.

Two minimal clients with auto-reconnect, auth-failure handling, and a JSON ping/pong round-trip on connect for latency measurement.

Python #

example.py

import asyncio, json, time, websockets
from datetime import datetime, timezone

API_KEY = "YOUR_API_KEY"
URL = f"wss://tokyo.coinlisting.pro/listings?key={API_KEY}"

def log(msg):
    print(f"{datetime.now(timezone.utc).isoformat(timespec='microseconds')[:-6]} | {msg}")

async def listen():
    async for ws in websockets.connect(URL):
        try:
            t0 = None
            async for msg in ws:
                data = json.loads(msg)
                if data.get("type") == "connection":
                    log(data)
                    t0 = time.perf_counter()
                    await ws.send(json.dumps({"type": "ping"}))
                elif data.get("type") == "pong":
                    log(f"Connection latency: {(time.perf_counter() - t0) * 500:.3f}ms")
                else:
                    log(data)
        except websockets.ConnectionClosedError as e:
            if e.code == 1008:
                log(f"Auth: {e.reason}")
                return
            log(f"Disconnected ({e.code}), reconnecting...")

asyncio.run(listen())

Output:

2026-02-02T15:03:42.198765 | {'type': 'connection', 'status': 'connected', 'username': 'demo', 'expiry': '2026-12-31 00:00:00', 'tier': 'pro', 'delay_ms': 0, 'sources': ['BINANCE', 'UPBIT', 'BITHUMB', 'COINBASE', 'BINANCE_ALPHA'], 'sent_time': 1770044622132, 'sent_time_iso': '2026-02-02T15:03:42.132000+00:00'}
2026-02-02T15:03:42.264123 | Connection latency: 0.543ms
2026-02-02T15:03:43.571892 | {'source': 'BINANCE', 'title': 'Binance Will List Example Token (EXM)', ...}

Node.js #

example.js

const WebSocket = require("ws");

const API_KEY = "YOUR_API_KEY";
const URL = `wss://tokyo.coinlisting.pro/listings?key=${API_KEY}`;

const log = (...args) => console.log(new Date().toISOString().slice(0, -1), "|", ...args);

function connect() {
  const ws = new WebSocket(URL);
  let t0;

  ws.on("message", (data) => {
    const msg = JSON.parse(data);
    if (msg.type === "connection") {
      log(msg);
      t0 = performance.now();
      ws.send(JSON.stringify({ type: "ping" }));
    } else if (msg.type === "pong") {
      log(`Connection latency: ${((performance.now() - t0) / 2).toFixed(3)}ms`);
    } else {
      log(msg);
    }
  });

  ws.on("close", (code, reason) => {
    if (code === 1008) {
      console.error(`Auth: ${reason}`);
      return;
    }
    setTimeout(connect, 1000);
  });

  ws.on("error", () => {});
}

connect();