Skip to content

JSONFoundation 2.3.0

Choose a tag to compare

@odrobnik odrobnik released this 27 Jun 07:57
0cc20d6

Rounds out the JSON-RPC transport family with the two simple transports consumers had been hand-rolling, so they now live in the shared package.

LoopbackTransport (in JSONRPCPeer)

A connected in-memory client/server pair (LoopbackTransport.pair()) — what one end writes, the other reads, with no framing. For embedding a server in-process, or for hermetic, subprocess-free peer tests. This is the "loopback transport" the JSONRPCMessageTransport docs already referenced.

let (clientT, serverT) = LoopbackTransport.pair()
let server = JSONRPCPeer(transport: serverT); await server.start()
let client = JSONRPCPeer(transport: clientT); await client.start()
let result = try await client.sendRequest(method: "ping", params: nil)

TCPClientTransport<Framing> (new JSONRPCTCP module)

A TCP client transport to host:port, generic over the wire MessageFraming — the socket sibling of the stdio transports (blocking reader thread + locked blocking write). Built on raw POSIX sockets, so a single implementation serves macOS, Linux and Android (Bionic) with zero external dependency; it's a plain opt-in module, not trait-gated. Connects to a listener only; the listening side (accept loop, Bonjour) stays with platform server stacks. Windows compiles to an unavailable stub.

Other

  • Both transports join the batteries-included JSONRPC umbrella product.
  • No source-breaking changes; purely additive.

Full Changelog: 2.2.0...2.3.0