# `Redis.PhoenixPubSub`
[🔗](https://github.com/joshrotenberg/redis_ex/blob/v0.7.1/lib/redis/phoenix_pubsub.ex#L1)

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 to `Redis.Connection.start_link/1`
    and `Redis.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)

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
