Live scoreboards
What the spectator sees
A scoreboard shows two things:
- Standings of the match (overall or per division), updated on every approved score.
- "On the range": per scoring tablet, the competitor currently shooting — stage, name, division, phase (make ready / running / scoring / approved), number of shots, last shot time or final time, and the provisional hits as soon as the RO enters them.
For a shootoff the board shows the double elimination bracket instead of standings: a tree from left to right with one column per round, every bout at the midpoint of the two bouts that feed it and connector lines between them (amber once decided), the winners bracket on top, the losers bracket below and the finals on the right (with a last chance bracket and lower final for three-life formats, and heat counts on best-of bouts); winner green, loser red, the champion on top and the placements below. The positions come from layoutBracket in packages/scoring, shared by the board, the portal and the tablet. The portal pushes the bracket to the Durable Object after every decision (bracket message in the live protocol).
Where it runs
| Form | How |
|---|---|
| Tablet in dashboard mode | same app, DashboardScreen; without a network it falls back to the locally calculated standings from the scores already synchronised to that tablet (or shared through the local hub); every account that may open the event can use it |
| TV / kiosk / browser | GET /scoreboard/:matchId?division=OPEN — framework-free HTML page with the same layout as dashboard mode in the app: every stage side by side with a switch for hit factor, time or percentage, the overall percentage last (the ranking), division buttons, the time of day and the squad countdown top right, who is shooting and a large shooting order on the right. It listens to the WebSocket and fetches what it shows from GET /live/matches/:id/board; works on the existing Raspberry Pi kiosks of agisko-dashboards |
| Custom integration | WebSocket /live/matches/:id?role=board, protocol in packages/shared/src/live.ts |
Without internet: the local hub
All live traffic normally goes through the portal: the scoring tablets push approved scores to the portal, which recomputes the standings and fans them out to the boards. On a range without internet, one tablet takes that role for the Wi-Fi it is on (menu Local hub → This tablet is the hub); it shows the address the other tablets enter under Connect to a hub. From then on:
- a tablet that has no copy of the event (no internet when it was set up) downloads it from the hub: event list → "Download from the hub"; dashboard mode and results then work on that tablet;
- scoring tablets send every approved score to the hub (and keep it in their own outbox for the portal);
- the hub stores the scores, queues them for the portal and forwards them the moment any internet is available; every other tablet pulls them back, so all tablets compute the same standings locally;
- the "On the range" panel travels the same way: scorers post the current competitor to the hub, dashboards poll it every two seconds;
- the dashboard shows the shooting order of the squad on the current stage bottom right: On the line (next up), On deck and everybody who still has to shoot. The order follows the squad rotation (see scoring); no-shows are not in it.
The scoreboard page of the website shows the same as dashboard mode in the app. The live channel tells it who is shooting and when the standings changed; the page then fetches GET /live/matches/:id/board?division=&onRange= (buildBoard in src/results.ts): the standings with hit factor, time and percentage per stage, the shooting order of the squad on the range (computed with remainingShooters, so the rotation and the no-shows are the engine's) and the squad to count down for (squadClock in packages/scoring, shared with the app). The chosen value is remembered in the browser.
Dashboard mode in the app computes the standings on the tablet from the synchronised scores (the live channel only tells it when to fetch new ones), so it looks the same with and without internet: every stage side by side with a switch at the top for hit factor, time, percentage or hits, and the overall percentage last, which the list is ranked on. Hits shows per stage the alphas, charlies and deltas, plus steel (S), misses (M) and no-shoots (NS) when there are any (9A 2C 1D 1M); the scoreboard page on the website has the same view. The squad list on the scoring screen marks the next three to shoot on the selected stage: on the line, on deck and in the hole. In the "On the range" card, next to the phase (make ready, running, scoring), both dashboards show the time of the last shot the timer pushed, so the board follows a run shot by shot. Top right it shows the time of day and, when the squad on the range (or the squad whose slot it is) has an end time, the time left for that squad; the last five minutes and overtime are red.
The hub serves scores, the stages, squads and competitors changed without a connection (walk-ins, see docs/sync-and-offline.md) and the live panel; every tablet downloads the match itself from the portal while it still has internet. Protocol: apps/tablet/src/hub/server.ts (plain HTTP on port 8787, JSON).
How it works
- One Durable Object (
MatchLive) per match as the hub, using the WebSocket Hibernation API (no cost when nothing happens). - After every accepted
sync/pushthe worker calculates the standings (buildAllResults, per division + overall) and POSTs them to the DO. The DO stores the snapshot and sends it to all boards; a new board immediately receives the latest state. - Scoring tablets connect as
role=scorer(Bearer token required) and send ephemeralcurrentevents while scoring. The DO keeps the latest state per tablet and removes it when the tablet loses its connection. These events never touch D1. - Final scores never come in via WebSocket: always via the sync API, so that offline and live follow the same path.
- Boards for matches with visibility
club/privatemust be logged in (cookie or Bearer) and have the permission; public matches are open.
Messages (summary)
Client → server: subscribe { role, divisions? }, current { shooter } (scorer), current_clear { deviceId }, ping.
Server → client: hello, results { division, rows[], updatedAt }, current { shooters[] }, error.
Pairing tablets with the hub by QR code
The hub tablet shows its address as a QR code on the Local hub screen; on the other tablets, Local hub → Scan QR code of the hub opens the camera, reads the address and connects at once. Typing the IP address still works.
Deep links and exports
- Portal results:
/#/matches/<id>/results?division=OPEN&category=LADY&stage=2&competitor=<competitorId>opens the chosen ranking, the stage results or a competitor's detail directly ("Copy link" buttons on the Results tab and in the detail view). - Scoreboard page:
/scoreboard/<id>?division=OPENshows one division. - Export: Export CSV (
/api/v1/matches/<id>/results.csv, public events also at/api/public/matches/<id>/results.csv) and Print / PDF (the browser's print dialog with a print stylesheet; "Save as PDF" gives a PDF).