Free PubSub in Elixir Phoenix Application

9 May 2019

If you need a pubsub, to connect LiveViews for example just use YourAppWeb.Endpoint.

YourAppWeb.Endpoint.subscribe("topic")
YourAppWeb.Endpoint.broadcast("topic", "event", %{data: "data"})
def handle_info(%{event: "event", topic: "topic", payload: payload}) do
  # Do whatever you want
end