Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

WebSocket API

Connection endpoint

wss://cryptolisting.ws

The server uses binary WebSocket frames containing UTF-8 JSON.

Query parameters

ParameterRequiredDescriptionExample
cexNoComma-separated list of exchanges to subscribe tobinance,upbit

Connection lifecycle

Client                              Server
  |                                   |
  |--- WSS handshake + API key -----→ |
  |                                   |-- Validate key
  |                                   |-- Check rate limits
  |                                   |-- Check connection limits
  |←---- 101 Switching Protocols -----|
  |                                   |
  |←---- Welcome message -------------|  (immediate)
  |                                   |
  |←---- Heartbeat -------------------|  (every 30s)
  |←---- Heartbeat -------------------|
  |                                   |
  |←---- Announcement ----------------|  (when detected)
  |                                   |
  |--- {"type":"test"} -------------→ |  (optional)
  |←---- Test Announcement -----------|  (only to you)
  |                                   |
  |←---- PING ----------------------- |  (every 15s)
  |--- PONG ------------------------→ |
  |                                   |
  |←---- Close (1000, key_expired) ---|  (if key expires)
  |                                   |

1. Handshake

The server validates your API key during the HTTP upgrade handshake. If validation fails, you receive an HTTP error response (not a WebSocket frame):

HTTP CodeReason
400Malformed WebSocket upgrade request
401Missing API key
403Invalid, revoked, or expired API key
429Rate limit or connection limit exceeded

2. Welcome message

Immediately after a successful handshake, the server sends a welcome message confirming your subscription parameters. See Message Reference.

3. Heartbeats

The server sends a JSON heartbeat message every 30 seconds. If you do not receive a heartbeat within ~35 seconds, your connection may be dead.

4. Ping/Pong

In addition to JSON heartbeats, the server sends WebSocket PING frames every 15 seconds. Your WebSocket library handles PONG responses automatically. If the server receives no PONG within 30 seconds, it closes your connection.

Most WebSocket libraries (Python websockets, Node.js ws, Go gorilla/websocket) handle PING/PONG automatically. You do not need to implement this yourself.

5. Announcements

When a listing or other exchange announcement is detected, the server sends an announcement message to all subscribers whose exchange filter matches. See Message Reference.

6. Disconnection

The server may close your connection with a WebSocket close frame. The close code and reason indicate why. See Error Handling.

Client-to-server messages

Client messages are subject to rate limiting (3 messages/minute) and frame size limits (1 KB max). The only supported client message is the test request:

{"type":"test"}

This returns a fake announcement to verify your integration is working. See Message Reference — Test Announcement for details.

Exceeding the client message rate limit (3/min) will result in disconnection. Test requests are additionally limited to 1 per minute per API key.