2.1.3 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT LicenseDistributed PubSub and Presence platform for the Phoenix Framework
Add phoenix_pubsub
to your list of dependencies in mix.exs
:
def deps do
[{:phoenix_pubsub, "~> 2.0"}]
end
Then start your PubSub instance:
defmodule MyApp do
use Application
def start(_type, _args) do
children = [
{Phoenix.PubSub, name: MyApp.PubSub}
]
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
end
Now broadcast and subscribe:
Phoenix.PubSub.subscribe(MyApp.PubSub, "user:123")
Phoenix.PubSub.broadcast(MyApp.PubSub, "user:123", :hello_world)
Testing by default spawns nodes internally for distributed tests.
To run tests that do not require clustering, exclude the clustered
tag:
$ mix test --exclude clustered
If you have issues running the clustered tests try running:
$ epmd -daemon
before running the tests.