Live updates

Message types

Use this page to read a message and keep your own copy of a topic up to date. There are four types, and each says what to do with data.

1. Read a message

Every message on a match or live channel has the same fields. type tells you what to do with data.

Field Meaning
id The message id. Keep the last one you handled.
type snapshot, patch, removed or refetch.
match The match id.
topic The topic the message is about.
revision A number that rises with each change to the topic, or null.
changed_at When the change happened, in UTC.
data The payload. null for removed and refetch.
sources Where the data was read and when.
availability Whether we hold the topic.
links.self Only on refetch. The path to request instead.

2. Replace on a snapshot

A snapshot is the whole topic. Replace what you hold.

Message
{
    "id": "1795724584512-0",
    "type": "snapshot",
    "match": "0199c5a0-7b1e-7c3a-9f4e-2d6b8a1c4e70",
    "topic": "stats",
    "revision": null,
    "changed_at": "2026-11-26T20:23:04.512Z",
    "data": {
        "stats": {
            "corners": {
                "home": {
                    "value": 4,
                    "source": "bet365",
                    "as_of": "2026-11-26T20:23:04.000Z"
                },
                "away": {
                    "value": 2,
                    "source": "bet365",
                    "as_of": "2026-11-26T20:23:04.000Z"
                }
            }
        },
        "disputed": []
    },
    "sources": [
        {
            "name": "bet365",
            "captured_at": "2026-11-26T20:23:04.000Z"
        }
    ],
    "availability": {
        "status": "available"
    }
}

3. Merge a patch

A patch is only what changed. A key that is missing from data has not changed, and a key set to null was removed. In the example, the home price of one market has changed and draw_no_bet is gone. Merge objects key by key. Arrays and other values replace what you hold.

Message
{
    "id": "1795724584512-0",
    "type": "patch",
    "match": "0199c5a0-7b1e-7c3a-9f4e-2d6b8a1c4e70",
    "topic": "odds",
    "revision": 41,
    "changed_at": "2026-11-26T20:23:04.512Z",
    "data": {
        "markets": {
            "match.result": {
                "home": {
                    "decimal": 1.62,
                    "fractional": "8/13"
                }
            },
            "draw_no_bet": null
        }
    },
    "sources": [
        {
            "name": "bet365",
            "captured_at": "2026-11-26T20:23:04.000Z"
        }
    ],
    "availability": {
        "status": "available"
    }
}

Player prices are too big to send in every patch. When a player market changes, an odds patch carries player_market_change_times instead: the key of each changed player market and when it changed. Fetch the odds with include=players&fields=player_markets to read the new prices.

Code
{
    "type": "patch",
    "topic": "odds",
    "data": {
        "player_market_change_times": {
            "g177920": "2026-11-26T20:23:04.512Z"
        }
    }
}

4. Drop a removed topic

A removed message means we no longer hold the topic. data is null, sources is empty and availability is unavailable with the reason not_held. Drop what you hold.

Message
{
    "id": "1795724584512-0",
    "type": "removed",
    "match": "0199c5a0-7b1e-7c3a-9f4e-2d6b8a1c4e70",
    "topic": "tracker",
    "revision": 12,
    "changed_at": "2026-11-26T20:23:04.512Z",
    "data": null,
    "sources": [],
    "availability": {
        "status": "unavailable",
        "reason": "not_held"
    }
}

5. Fetch again on a refetch

A refetch means the message was too large to send, or could not be built. data is null. Request links.self to get the whole topic, or load it with the live snapshot.

Message
{
    "id": "1795724584512-0",
    "type": "refetch",
    "match": "0199c5a0-7b1e-7c3a-9f4e-2d6b8a1c4e70",
    "topic": "stats",
    "revision": null,
    "changed_at": "2026-11-26T20:23:04.512Z",
    "data": null,
    "sources": [
        {
            "name": "bet365",
            "captured_at": "2026-11-26T20:23:04.000Z"
        }
    ],
    "availability": {
        "status": "available"
    },
    "links": {
        "self": "/api/v2/matches/0199c5a0-7b1e-7c3a-9f4e-2d6b8a1c4e70/stats"
    }
}

6. Apply messages

Keep one state per match and topic. Skip a message whose revision is lower than the one you hold, since it arrived late.

const state = {};
const revisions = {};

function merge(target, patch) {
  for (const [key, value] of Object.entries(patch)) {
    const isObject = (item) => item !== null && typeof item === 'object' && !Array.isArray(item);

    if (value === null) {
      delete target[key];
    } else if (isObject(value) && isObject(target[key])) {
      merge(target[key], value);
    } else {
      target[key] = value;
    }
  }
}

async function handle(message) {
  const key = `${message.match}.${message.topic}`;

  if (message.revision !== null && message.revision < (revisions[key] ?? 0)) {
    return;
  }

  if (message.type === 'snapshot') {
    state[key] = message.data;
  } else if (message.type === 'patch') {
    merge((state[key] ??= {}), message.data);
  } else if (message.type === 'removed') {
    delete state[key];
  } else if (message.type === 'refetch') {
    const response = await fetch(`https://odds-feed.on-forge.com${message.links.self}`, {
      headers: { Authorization: 'Bearer YOUR_KEY' },
    });

    state[key] = (await response.json()).data;
  }

  revisions[key] = message.revision ?? revisions[key];
}

Reference

Limit Value
Message size A message over 32 KB is sent as refetch.
Odds Yorkie

Prices are shown as bet365 offers them. OddsYorkie supplies data only and does not take bets. 18+ only. BeGambleAware.org