Skip to main content

Module feed

Module feed 

Source
Expand description

GET /api/feed: every game on the server as server-sent events, for sites and dashboards that follow it (esports-lab follows it for its ratings and pricing). No token needed; it shows what the public game streams show.

Events:

  • start: a game began (the public game description, as the first line of /api/stream/game/{id}).
  • move: it moved on (the same description: position, last move, ply). While a game is live its moves come CHESS_PUBLIC_DELAY_PLIES behind, as on the public stream.
  • end: it finished: the game as /game/export/{id} gives it in JSON (players, ratings and rating changes, status, winner, moves, clock). Its SSE id is when the server recorded it finished (Unix ms): the finish for a game played here, the upload for a game played offline in the iOS app (which may have finished days before).

A client that reconnects with Last-Event-ID (browsers do it themselves), or asks with ?since=<Unix ms>, first gets the end of every game recorded since then, oldest first, then the live events, so a consumer that keeps the last id misses nothing, late uploads included. ?game=<id> follows one game; ?only=end sends only finished games. A comment line every 15 seconds keeps proxies from closing the stream.

Functionsยง

feed