Live Socket.IO API

Connect to the authenticated ChartInspect Socket.IO price stream and filter supported symbols.

The live API uses Socket.IO on namespace /api-ws. It is not a raw RFC 6455 WebSocket endpoint. Use a Socket.IO client and a Pro API key.

#JavaScript

javascript
import { io } from "socket.io-client";

const socket = io("https://chartinspect.com/api-ws", {
  auth: { apiKey: process.env.CHARTINSPECT_API_KEY },
  transports: ["websocket", "polling"]
});

socket.on("initial-prices", (updates) =>; console.log(updates));
socket.on("price-update", (update) =>; console.log(update));
socket.on("connect_error", (error) =>; console.error(error.message));

// The payload is a bare array, not { symbols: [...] }.
socket.emit("subscribe", ["BTC", "ETH", "SOL"]);
socket.on("subscribed", ({ symbols }) =>; console.log(symbols));

#Python

python
import os
import socketio

sio = socketio.Client()

@sio.on("price-update", namespace="/api-ws")
def on_price(update):
    print(update)

sio.connect(
    "https://chartinspect.com",
    auth={"apiKey": os.environ["CHARTINSPECT_API_KEY"]},
    namespaces=["/api-ws"],
)
sio.emit("subscribe", ["BTC", "ETH", "SOL"], namespace="/api-ws")
sio.wait()

#Events

DirectionEventPayload
Server to clientinitial-pricesArray of cached price updates no more than 60 seconds old, when available
Server to clientprice-update{ symbol, price, volume, timestamp, change?, changePercent? }
Client to serversubscribeBare array of symbol strings
Server to clientsubscribed{ symbols: string[] } containing accepted symbols
Server to clienterror{ message: string } for invalid subscription payloads

All supported symbol rooms are joined on connection. Calling subscribe replaces that set with the accepted symbols. There is no separate unsubscribe event.

#Supported Symbols and Limits

BTC, ETH, LTC, XRP, BCH, ADA, DOT, LINK, BNB, DOGE, UNI, SOL, MATIC, AVAX, ATOM, XLM, ALGO, VET, ICP, and FIL are supported.

Each user can hold at most two concurrent API stream connections. Enterprise endpoint and response-field grants also apply. Clients should reconnect with bounded exponential backoff and handle an empty initial cache without treating it as an authentication failure.

Was this page helpful?