Snodo.Client.Direct (snodo v0.3.2)

Copy Markdown View Source

In-process transport for Snodo.Client.direct/2.

Each request runs Snodo.Server.dispatch/3 in the calling process with a :direct transport context, so :timeout does not apply. The context carries the dialect's version as the mcp-protocol-version request header, which is how the initialize-era dialects select themselves after initialize.

A request with progress: runs the dispatch in a linked task instead, with a progress sink owned by the calling process. The caller acknowledges each of the handler's Snodo.Progress.report/3 calls after passing the notification to the progress function, as a server transport does after writing it.

A subscriptions/listen request opened with Snodo.Client.listen/3 is dispatched in a process of its own, which then serves the server-side subscription as a server transport would: it owns the source worker, shapes each event through Snodo.Subscription, and closes the source when the stream ends. Closing the subscription closes the source with {:cancelled, "Closed by the client"}; the owner's exit closes it with {:disconnected, {:owner_down, reason}}.

Summary

Types

state()

@type state() :: %{runtime: Snodo.Server.Runtime.t(), auth: term()}