An OzMcp.PubSub that uses :pg (Erlang process groups).
The module sends a broadcast to the sessions of all the nodes that are connected and run the same instance. Set it in the child spec:
{OzMcp, server: MyApp.McpServer, pubsub: OzMcp.PubSub.PG, ...}Rules:
- The instance has the same name on every node.
- The nodes are connected (Erlang distribution). OzMcp does not connect them.
- The delivery is "at most once". There is no acknowledgement and no
order between two senders. A node that has just joined the cluster can
miss a broadcast for a short time, until
:pghas synchronised its groups. - A node that is cut from the cluster gets no broadcast. The sessions of the other nodes get it. The groups are synchronised again when the nodes connect.
OzMcp.Sessions.list_principal/2 and OzMcp.Sessions.terminate_principal/2
read the sessions of the local node only.
Summary
Functions
The name of the :pg scope of the instance.