JSONFoundation 2.4.0
Three purely-additive, Foundation-only pieces extracted from SwiftMCP's HTTP/SSE work so they can be shared across LSP / ACP / SwiftMCP.
SSEEventEncoder (JSONRPCWire)
The outbound counterpart of the existing SSEEventDecoder: encodes a data event (optional event/id/retry) or a comment to text/event-stream bytes. Pure, stateless, Data in/out — an SSE server now has a codec symmetric to the client's.
JSONRPCSSEServer (new module)
The transport-agnostic machinery for serving SSE (depends only on JSONRPCWire):
SSEStreamHub— a registry of SSE streams with a bounded replay buffer, resume-after-disconnect viaLast-Event-ID, retention of disconnected streams, and liveness/force-close. Keyed only by stream id; knows nothing about sessions or JSON-RPC. A synchronousfinal classby design, so a consumer holds it inside its own isolation (an actor) and calls it atomically.SSEEventID(<uuid>:<sequence>resume anchor),SSEStreamSink(the liveness/close seam a transport adapter supplies), and theSSEMessage/SSEEventvalue types.
RequestCorrelator<Key, Reply> (JSONRPCPeer)
A sink-agnostic, key+reply-generic "match replies to the ids I sent" primitive — the channel-independent half of being a JSON-RPC caller. Unlike JSONRPCPeer it owns no transport and performs no send: the caller writes the request itself and uses the correlator only to park and resolve/fail the waiter.
Notes
- No external dependencies, no platform-floor change (Foundation only).
JSONRPCSSEServeris a separate library so a client-only build doesn't pull it. - Purely additive; no source-breaking changes.
Full Changelog: 2.3.0...2.4.0