v0.1.2

SSE Streaming

Last updated


This page explains how Server-Sent Events (SSE) responses are detected and displayed live.

Detection


Streaming mode starts when the response Content-Type contains text/event-stream; only the response matters, whether the request sends an Accept: text/event-stream header makes no difference.
  1. ### SSE Stream
  2. GET https://sse.dev/test
  3. Accept: text/event-stream
  4. ###

Live Rendering


BehaviorDescription
Line-by-line appendbufio.Scanner redraws the info pane on every line; raw lines are shown as-is (including data: and event: prefixes)
Auto-scrollScrolls to the bottom after each redraw
Display limitOnly the last 100 lines are kept on screen
Header lineAfter the status and headers, Duration: elapsed | Events: count updates on every line

Events is the number of lines read divided by 2, assuming each event is one data line plus one blank line; multi-line data: or events with event:/id: lines make the count diverge from the real event count.

Completion


When the server closes the connection, the hint bar shows (status) METHOD URL | total duration; on a read error it shows a red Stream error: ... and keeps what was received in the info pane.

Timeout


The HTTP client Timeout is fixed at 120 seconds and covers reading the body.
中文