Skip to Content
GuidesDemo WebSocket API

Demo WebSocket API

Use the demo WebSocket endpoint to try live ticks and historical candles with the GoCharting Charting SDK. No API key or login is required.

Live demo

Chart wired to wss://gocharting.com/sdk/ws (ticks + history):

Open in CodePen  | Full screen 

Endpoint

wss://gocharting.com/sdk/ws

Browser clients should connect from an allowed site origin (for example gocharting.com or localhost). Tools like Postman that omit the Origin header are also supported.

After connect

The server sends a text welcome frame:

Welcome-{connection-id}

Keep the connection alive:

PING

Server reply:

PONG

You can also send PING-{token} and receive PONG-{token}.

Demo symbols

SymbolDescription
BYBIT:FUTURE:BTCUSDTBybit BTC/USDT perpetual
BYBIT:FUTURE:ETHUSDTBybit ETH/USDT perpetual

Other symbols are ignored (only allowlisted symbols appear in the ack).

Live trades are not sent until you SUBSCRIBE on that connection. UNSUBSCRIBE stops fan-out for that connection only — the demo server keeps the Bybit feeds warm in the backend regardless.

Live trades

Subscribe

{ "command": "SUBSCRIBE", "channel": "trade", "payload": ["BYBIT:FUTURE:BTCUSDT", "BYBIT:FUTURE:ETHUSDT"] }

Ack

{ "command": "SUBSCRIBE", "channel": "trade", "payload": ["BYBIT:FUTURE:BTCUSDT", "BYBIT:FUTURE:ETHUSDT"] }

Only supported symbols appear in the ack list.

Unsubscribe

{ "command": "UNSUBSCRIBE", "channel": "trade", "payload": ["BYBIT:FUTURE:BTCUSDT"] }

Trade stream (server to client)

{ "channel": "trade", "payload": { "BYBIT:FUTURE:BTCUSDT": [ { "ltp": 67542.1, "l_sz": 0.01, "side": "Buy", "t_ms": 1721040000123 } ] } }

Fields may vary slightly by feed; treat unknown fields as optional.

Historical candles (timeseries)

All candle traffic is JSON text frames (not binary).

Request

{ "request_id": 1, "command": "timeseries", "payload": { "symbol": "BYBIT:FUTURE:BTCUSDT", "interval": "1m", "session": "RTH", "hint": "rows=200", "echo": "chart-1" } }
FieldRequiredDescription
symbolyesExample: BYBIT:FUTURE:BTCUSDT
intervalyesExample: 1m, 5m, 15m, 1h, 1D
sessionrecommendedExample: RTH
hintnoComma-separated options, example: rows=200
echonoEchoed back so you can correlate chart panes
request_idrecommendedEchoed so you can match responses

Not supported: seconds intervals (for example 1s, 10s).

Response (one or more chunks)

{ "command": "timeseries", "request_id": 1, "final": 1, "echo": "chart-1", "payload": { "criteria": { "symbol": "BYBIT:FUTURE:BTCUSDT", "interval": "1m", "session": "RTH" }, "summary": { "2026-07-15": 42 }, "bars": { "2026-07-15": [ { "date": "2026-07-15T10:00:00", "open": 67000.0, "high": 67120.5, "low": 66980.0, "close": 67055.2, "volume": 123.45 } ] } } }
finalMeaning
0More candle chunks will follow
1 or 2Done for this request

For daily (1D) bars, payload.bars may be a flat array instead of a date-to-bars map.

Errors

Most errors look like:

{ "command": "ERROR", "request_id": 1, "message": "Human-readable message." }

Candle errors may also include:

{ "command": "ERROR", "request_id": 1, "in": {}, "out": { "message": "Symbol BYBIT:FUTURE:ETHUSDT is not supported.", "dismissable": false, "message_type": "UNSUPPORTED_SYMBOL" } }

Common messages

SituationMessagemessage_type (if any)
Bad JSONInvalid message.
Unknown commandUnsupported command.— (plus command_in)
Bad subscribe payloadInvalid subscribe payload.
Unsupported symbolSymbol … is not supported.UNSUPPORTED_SYMBOL
Bad intervalInvalid interval.INVALID_INTERVAL
Seconds intervalSeconds intervals are not supported.UNSUPPORTED_INTERVAL
Empty historyNo data found for ….NO_DATA
Too many requestsRate limit exceeded. Please try again later.— (plus remaining)

Connection-level limits return HTTP 429 before upgrade:

Too many requests. Please try again later.

Quick start (browser)

const ws = new WebSocket("wss://gocharting.com/sdk/ws"); ws.onmessage = (ev) => { if (typeof ev.data !== "string") return; if (ev.data.startsWith("Welcome-") || ev.data.startsWith("PONG")) { console.log(ev.data); return; } const msg = JSON.parse(ev.data); console.log(msg); }; ws.onopen = () => { ws.send("PING"); ws.send( JSON.stringify({ request_id: 1, command: "timeseries", payload: { symbol: "BYBIT:FUTURE:BTCUSDT", interval: "1m", session: "RTH", hint: "rows=200", echo: "demo-chart", }, }) ); }; setInterval(() => { if (ws.readyState === WebSocket.OPEN) ws.send("PING"); }, 20000);

Integrator checklist

  1. Connect to wss://gocharting.com/sdk/ws
  2. Expect a Welcome- frame, then send PING periodically
  3. SUBSCRIBE the symbols you need, then listen on channel: "trade"
  4. Fetch history with command: "timeseries" and read chunks until final is 1 or 2
  5. Handle command: "ERROR" as a first-class response path

Demo limits

Approximate per-IP guidance (subject to change):

  • Up to about 5 concurrent connections
  • Connection / message / candle request rate limits apply
  • On limit: wait and retry (Retry-After on HTTP 429, or remaining on WebSocket errors)
Last updated on