A Phoenix.PubSub adapter backed by Redis.
Uses Redis Pub/Sub for cross-node message broadcasting, allowing multiple Elixir nodes to share a Phoenix.PubSub namespace.
Usage
Add to your supervision tree:
children = [
{Phoenix.PubSub,
name: MyApp.PubSub,
adapter: Redis.PhoenixPubSub,
redis_opts: [host: "localhost", port: 6379]}
]Then use Phoenix.PubSub as normal:
Phoenix.PubSub.subscribe(MyApp.PubSub, "user:123")
Phoenix.PubSub.broadcast(MyApp.PubSub, "user:123", {:updated, %{name: "Alice"}})Options
:redis_opts- keyword list passed toRedis.Connection.start_link/1andRedis.PubSub.start_link/1(host, port, password, etc.):node_name- node identifier (default:node()):compression- compression level for:erlang.term_to_binary/2(0 = none, 1-9 = zlib levels, default: 0)
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.