Skip to main content

Global live stream

The global stream emits every score_update and status_change from every live match across every league your account tracks.

URL

wss://api.scorelytics.pro/v1/ws/live?api_key=sk_live_...

Message format

Identical to the single-match stream — the match_id field tells you which match each message belongs to.

{
"type": "score_update",
"match_id": "abc123",
"data": { "home": 2, "away": 1, "minute": 67 }
}

When to use it

  • A live ticker that shows everything happening right now.
  • Notification systems that fan out to user-subscribed match IDs.
  • Analytics ingestion into your warehouse.

When not to use it

If you only care about 1–10 specific matches, opening one /v1/ws/match/{id} per match is cheaper for both you and us — you avoid filtering work, and we avoid sending you data you'll throw away.

Example: notify on goals only

const ws = new WebSocket(
`wss://api.scorelytics.pro/v1/ws/live?api_key=${apiKey}`
);

const lastScore = new Map();

ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type !== 'score_update') return;
const prev = lastScore.get(msg.match_id) ?? { home: 0, away: 0 };
const next = msg.data;
if (next.home > prev.home || next.away > prev.away) {
notify(`Goal in ${msg.match_id}: ${next.home}-${next.away}`);
}
lastScore.set(msg.match_id, { home: next.home, away: next.away });
};

Throughput

Peak throughput on the global stream depends on how many matches are live at once across your tracked leagues. On a typical Saturday afternoon you should expect 5–20 messages per second. The connection will not flood — each match emits at most a handful of messages per minute.

Filtering

There is no server-side filter on /v1/ws/live — filter client-side by inspecting match_id, or open per-match connections instead.