SSE Tester

2 min read

SSE Tester

The SSE Tester is a single-file browser tool located in tools/test-sse. It lets you subscribe to any number of PostgreSQL NOTIFY channels over a live Server-Sent Events connection and watch the incoming events in real time.

Features

  • Multi-channel subscriptions — add or remove channels as pill tags before connecting. All channels are passed as a comma-separated ?channels= query parameter.
  • All authentication methods — the Password tab uses HTTP Basic Auth (direct credentials, no JWT needed); the Bearer Token tab accepts a JWT or API token.
  • Live stream — uses the Fetch Streams API with an AbortController for clean disconnect. SSE lines are parsed manually so event:, data:, and heartbeat (:) fields are all handled correctly.
  • JSON syntax highlighting — data payloads that are valid JSON are pretty-printed with colour coding.
  • Persistent settings — API URL, prefix, database, login, and channel list are saved to localStorage.

Authentication

The tool verifies credentials before revealing the subscription panel. Clicking Verify & Continue calls capabilities with the chosen header — if PgArachne returns a successful response, the subscription panel unlocks.

  • Password tab — sends Authorization: Basic <base64(user:pass)>. The database user must have GRANT EXECUTE on the target functions and access to the SSE endpoint; no GRANT <role> TO pgarachne is needed.
  • Bearer Token tab — sends Authorization: Bearer <token>. Paste a JWT (obtained via the JWT Getter) or a long-lived API token.
How to enable it: Set STATIC_FILES_PATH to tools/test-sse and visit http://localhost:8080. Alternatively, open index.html directly in a browser — all functionality works without a local server.