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 it finished (Unix ms).

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 finished since then, oldest first, then the live events. ?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