Redis.PhoenixPubSub (Redis v0.7.1)

Copy Markdown View Source

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

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)