Backplane.McpProtocol.Server.Modern.Subscriptions (backplane_mcp_protocol v0.6.0)

Copy Markdown

Monitored, in-process subscription hub for modern MCP notification streams.

The hub serializes subscription establishment and publication so its ACK is always queued before any event published after subscribe returns.

Summary

Functions

Returns a specification to start this module under a supervisor.

Gracefully completes every current subscription without stopping the hub.

Types

option()

@type option() :: {:name, GenServer.name()} | GenServer.option()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(hub)

@spec close(GenServer.server()) :: :ok

Gracefully completes every current subscription without stopping the hub.

publish(hub, notification)

@spec publish(GenServer.server(), map()) :: :ok

start_link(opts \\ [])

@spec start_link([option()]) :: GenServer.on_start()

subscribe(hub, subscriber, request_context)

@spec subscribe(GenServer.server(), pid(), map()) ::
  {:ok, reference()} | {:error, Backplane.McpProtocol.MCP.Error.t()}

unsubscribe(hub, subscription_ref)

@spec unsubscribe(GenServer.server(), reference()) :: :ok