Register an open GET SSE stream. A fresh per-stream session token is minted and the listener immediately receives the leading endpoint event (basic/transports §HTTP with SSE: the server MUST send it "When a client connects") whose URI carries that token, so a later POST can be correlated back to exactly this stream. Returns the listener id.
Deliver a raw JSON-RPC payload as an SSE message event to the single stream whose minted session token is sessionId, so a response is routed only to the client that issued the corresponding POST and never leaks across sessions. A listener whose write throws (a disconnected client) is dropped so the channel self-heals. An empty payload, or an unknown/empty token (no matching open stream), is a no-op.
Number of currently-open legacy streams.
Drop a listener (its GET stream closed).
The per-stream session token minted for the listener id, or null when no such listener exists. Exposed so the two-endpoint flow (and tests) can correlate a POST back to the stream that should receive its reply.
The legacy 2024-11-05 HTTP+SSE server->client channel. It manages the open GET SSE listeners and routes JSON-RPC server messages onto them as SSE message events. On registration a listener is minted a per-stream session token and immediately receives the endpoint event whose data carries that token as a ?sessionId= query parameter on the message-POST path, as the transport requires before any other traffic. The client echoes the token on every POST, so a response is routed back ONLY to the originating stream — never broadcast to other concurrently-connected clients (which would leak one client's results onto another client's stream).