phoenix_pubsub_redis v2.1.3 Phoenix.PubSub.Redis

Phoenix PubSub adapter based on Redis.

To use Redis as your PubSub adapter, simply add it to your Endpoint's config:

config :my_app, MyApp.Endpoint,
  pubsub: [adapter: Phoenix.PubSub.Redis,
           host: "192.168.1.100", node_name: System.get_env("NODE")]

You will also need to add :phoenix_pubsub_redis to your deps:

defp deps do
  [{:phoenix_pubsub_redis, "~> 2.1.0"}]
end

And also add :phoenix_pubsub_redis to your list of applications:

def application do
  [mod: {MyApp, []},
   applications: [..., :phoenix, :phoenix_pubsub_redis]]
end

Options

  • :url - The url to the redis server ie: redis://username:password@host:port
  • :name - The required name to register the PubSub processes, ie: MyApp.PubSub
  • :node_name - The required name of the node, defaults to Erlang --sname flag.
  • :host - The redis-server host IP, defaults "127.0.0.1"
  • :port - The redis-server port, defaults 6379
  • :password - The redis-server password, defaults ""
  • :redis_pool_size - The size of the redis connection pool. Defaults 5
  • :pool_size - Both the size of the local pubsub server pool and subscriber shard size. Defaults 1. A single pool is often enough for most use-cases, but for high subscriber counts on a single topic or greater than 1M clients, a pool size equal to the number of schedulers (cores) is a well rounded size.

Summary

Functions

start_link(name, opts)