README.md

March 26, 2026 ยท View on GitHub

Phoenix.PubSub.Redis

A Redis PubSub adapter for the Phoenix framework

See the docs for more information.

Usage

To use Redis as your PubSub adapter, simply add it to your deps and application supervision tree:

# mix.exs
defp deps do
  [
    {:phoenix_pubsub_redis, "~> 3.0"}
  ]
end

# application.ex
children = [
  # ...,
  {Phoenix.PubSub,
   adapter: Phoenix.PubSub.Redis,
   redis_opts: "redis://localhost:6379",
   node_name: System.get_env("NODE")}

  # or with keyword options:
  {Phoenix.PubSub,
   adapter: Phoenix.PubSub.Redis,
   redis_opts: [host: "example.com", port: 6379],
   node_name: System.get_env("NODE")}

Config Options

OptionDescriptionDefault
:nameThe required name to register the PubSub processes, e.g. MyApp.PubSub.
:node_nameThe name of the node. Must be unique.node()
:compression_levelCompression level applied to serialized terms - 0 (none) to 9 (highest).0
:redis_pool_sizeThe size of the Redis connection pool.5
:redis_optsRedix connection options - either a Redis URL string or a keyword list. See Redix docs for details.