More than EventSource
The browser's EventSource only does GET requests and cannot set custom headers. The SSE client in Swastik Codes can:
- use GET or another HTTP method, with a request body, which is what streaming APIs such as LLM completion endpoints expect
- add headers and use the Authorization helpers (Bearer, API key, OAuth 2.0 and more)
- add query params and resolve
{{variables}}from your environment
POST https://api.example.com/v1/chat/stream
Authorization: Bearer {{apiKey}}
Content-Type: application/json
Accept: text/event-stream
{ "messages": [{ "role": "user", "content": "Hello" }], "stream": true }Event types, ids and resuming
SSE events can carry an event: name, an id: and a retry: hint. The client shows the event name with each message and can filter the log to the event types you list (comma-separated). It keeps track of the last event id; set Last-Event-ID to resume a stream from a specific point, or pick an event in the log to resume from it on the next connect. That is the easiest way to check that your server actually honours Last-Event-ID.
Reconnection behaviour you can control
Turn on reconnecting when the stream ends to follow the standard SSE behaviour, including the server's retry: value. You can set the reconnect delay, the number of attempts (or unlimited), a connection timeout and the maximum event size; oversized events are discarded with a clear error instead of stalling the session.
A searchable event log
Events arrive in a timestamped log with search, a sent/received/connection-events filter, JSON formatting, copying, and download as JSON. Select two events to see the time between them, which is useful when checking heartbeat intervals or token streaming speed.
A tiny server to try it on
import express from "express";
const app = express();
app.get("/events", (req, res) => {
res.set({ "Content-Type": "text/event-stream", "Cache-Control": "no-cache" });
res.flushHeaders();
let n = 0;
const timer = setInterval(() => {
res.write(`id: ${++n}\nevent: tick\ndata: ${JSON.stringify({ n })}\n\n`);
}, 1000);
req.on("close", () => clearInterval(timer));
});
app.listen(3000);Deploy it somewhere public, point the SSE client at https://your-host/events, and you will see tick events with increasing ids.
How it works
- Open the app, create a request and change its type to Server-Sent Events.
- Enter the stream URL, add headers, auth or a body, and connect.
- Watch events arrive, filter them, and save the request to a collection.
Connecting needs a free account: the web app relays the stream through the Swastik Codes server, which refuses private and loopback addresses. The desktop app for Windows and Linux connects from your machine.
Frequently asked questions
Can I test an SSE endpoint that needs a POST body?
Yes. Choose the HTTP method and add a body in the Body tab. This covers streaming APIs that take a JSON request and answer with text/event-stream.
Does the client honour the server's retry value?
Yes, when reconnecting is enabled the client follows the retry: field; otherwise the reconnect delay you set applies.
How do I check Last-Event-ID handling?
Set the Last-Event-ID value (or pick an event from the log) and reconnect. Your server receives it as the Last-Event-ID header and should resume after that event.
Is SSE the same as streaming over WebSocket?
No. SSE is one-way, server to client, over plain HTTP. If you need two-way messaging, use the WebSocket client.