ExMCP.SubscriptionRegistry (ex_mcp v1.0.0-rc.8)

Copy Markdown View Source

Tracks streamable-HTTP resource subscriptions by MCP session.

The owning process only provides a supervised lifetime for the ETS indexes. Subscription writes and broadcast lookups operate directly on ETS so one registry mailbox does not become the notification hot path.

Summary

Functions

Returns a specification to start this module under a supervisor.

Removes every subscription owned by a terminated or expired session.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

remove_session(session_id)

@spec remove_session(String.t()) :: :ok

Removes every subscription owned by a terminated or expired session.

sessions(uri)

@spec sessions(String.t()) :: [String.t()]

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

subscribe(session_id, uri)

@spec subscribe(String.t(), String.t()) :: :ok | {:error, atom()}

subscriptions(session_id)

@spec subscriptions(String.t()) :: [String.t()]

unsubscribe(session_id, uri)

@spec unsubscribe(String.t(), String.t()) :: :ok