Skip to Content
KashRock Docs

WebSockets

Get live match and board changes pushed to your app instead of polling.

Starts on

Builder and up

Credits per call

1 to connect

Endpoint

WS /v7/live/ws

MCP tool

get_live_ws

By plan

Builder: 2 connections, 5 matches. Pro: 10 and 25, plus the whole board. Quant: 20 and 50.

Limits

Connect from your app, not through MCP: get_live_ws returns the URL, auth and subscribe messages. Use ?ticket= from POST /v7/ws-ticket when a client cannot set headers.

Connect

import WebSocket from "ws";

const ws = new WebSocket("wss://kashrock.up.railway.app/v7/live/ws", {
  headers: { "x-api-key": process.env.KASHROCK_API_KEY },
});

ws.on("open", () => {
  ws.send(JSON.stringify({ op: "subscribe", sport: "cs2", game_id: "kr_cs2_..." }));
});

ws.on("message", (raw) => {
  const msg = JSON.parse(raw);
  if (msg.op === "update") console.log(msg.type, msg.data);
});

Sandbox and Hobby keys are refused at the handshake. Browsers that cannot set headers use a ticket.

Messages you send

SendDoes
{"op":"subscribe","sport":"cs2","game_id":"<kr_match_id>"}Follow one match
{"op":"subscribe","sport":"cs2","game_id":"*"}Every live match in the title (Pro and up)
{"op":"subscribe","sport":"cs2","board":"lines"}Pushed changes to the lines board (props for props)
{"op":"unsubscribe","sport":"cs2","game_id":"<kr_match_id>"}Stop following
{"op":"ping"}Keep-alive; answered with pong

Messages you get

opCarries
helloYour plan and socket limits
snapshotThe full state for one match, or the full board on a board subscribe
updateA change: type is frame, boxscore, meta, odds, lines or props. Board updates carry only what moved, plus removed[]
eventKill and death batches, always an array
games_listThe live board when you subscribed to game_id: "*"
statusstats_available and reason when a match's stats stop or come back

Socket connects, subscribes and pushes do not count against your requests-a-minute limit. Limits by plan:

PlanPriceCreditsRate limitAPI keysLive dataHistoryWebSocket
Sandbox$0/mo1,500 credits a day10 req/min1No live dataNoneNone
Hobby$29.99/mo1.5M credits a month30 req/min115s delayLast 90 daysNone
Builder$99/mo5M credits a month100 req/min3Real timeFull archive2 connections, 5 matches
Pro$199/mo10M credits a month250 req/min5Real timeFull archive10 connections, 25 matches, whole board
Quant$299/mo or $2,990/yr20M credits a month500 req/min10Real timeFull archive20 connections, 50 matches, whole board

The REST equivalents are on Live data.

On this page