Fix the SSE endpoint's Content-Type so GeckoView actually receives updates #6

Merged
eddie merged 1 commit from sse-correct-content-type into main 2026-09-05 13:36:00 -07:00
Owner

Reported: the TV never auto-updates scores, even though /events (the
Server-Sent Events endpoint driving the live scoreboard) worked fine in
Chromium and desktop Firefox during earlier testing this session.

Bug

/events was sending Content-Type: text/plain instead of
text/event-stream. Confirmed directly with curl -I against the live
endpoint - this was a real, pre-existing bug in the app, not a guess.

Per the WHATWG EventSource spec, the user agent must fail the connection
if the response's MIME type isn't exactly text/event-stream. Chromium is
lenient about this in practice and processes the stream anyway; that
leniency is almost certainly why every desktop test in this session looked
fine while the actual TV - GeckoView, which enforces the spec correctly -
silently never got a working connection at all.

Fix

Changed mimetype='text/plain' to content_type='text/event-stream' (not
mimetype=, which would let Flask auto-append ; charset=utf-8 -
unnecessary on this content type and one more way to hand a picky
implementation a content-type it won't match exactly).

Testing

Verified locally: the response now sends Content-Type: text/event-stream
with no charset param, and the stream still delivers the same data: [...]
payload as before.

Reported: the TV never auto-updates scores, even though `/events` (the Server-Sent Events endpoint driving the live scoreboard) worked fine in Chromium and desktop Firefox during earlier testing this session. ## Bug `/events` was sending `Content-Type: text/plain` instead of `text/event-stream`. Confirmed directly with `curl -I` against the live endpoint - this was a real, pre-existing bug in the app, not a guess. Per the WHATWG EventSource spec, the user agent **must** fail the connection if the response's MIME type isn't exactly `text/event-stream`. Chromium is lenient about this in practice and processes the stream anyway; that leniency is almost certainly why every desktop test in this session looked fine while the actual TV - GeckoView, which enforces the spec correctly - silently never got a working connection at all. ## Fix Changed `mimetype='text/plain'` to `content_type='text/event-stream'` (not `mimetype=`, which would let Flask auto-append `; charset=utf-8` - unnecessary on this content type and one more way to hand a picky implementation a content-type it won't match exactly). ## Testing Verified locally: the response now sends `Content-Type: text/event-stream` with no charset param, and the stream still delivers the same `data: [...]` payload as before.
Reported: the TV never auto-updates scores, even though the /events
endpoint (Server-Sent Events, driving the live scoreboard) worked fine in
Chromium and desktop Firefox during earlier testing.

/events was sending Content-Type: text/plain instead of text/event-stream.
Confirmed directly with curl -I against the live endpoint - this was a real,
pre-existing bug in the pulled app, not a guess. Per the WHATWG EventSource
spec, the user agent MUST fail the connection if the response's MIME type
isn't exactly text/event-stream. Chromium is lenient about this in practice
and processes the stream anyway; that leniency is almost certainly why every
desktop test in this session looked fine while the actual TV - GeckoView,
which enforces the spec correctly - silently never got a working connection
at all.

Changed mimetype='text/plain' to content_type='text/event-stream' (not
mimetype=, which would let Flask auto-append '; charset=utf-8' - unnecessary
on this content type and one more way to hand a picky implementation a
content-type it won't match exactly).

Verified locally: the response now sends Content-Type: text/event-stream
with no charset param, and the stream still delivers the same
data: [...] payload as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
eddie merged commit 771e1b4e07 into main 2026-09-05 13:36:00 -07:00
eddie deleted branch sse-correct-content-type 2026-09-05 13:36:00 -07:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
eddie/FigFamFamilyPlinkoScoreboard!6
No description provided.