Class: Phoenix::Pubsub::Redis
- Inherits:
-
Object
- Object
- Phoenix::Pubsub::Redis
- Defined in:
- lib/phoenix/pubsub.rb
Instance Method Summary collapse
-
#initialize(redis_url: 'redis://localhost:6379', phoenix_class: 'Chat.PubSub') ⇒ Redis
constructor
A new instance of Redis.
- #publish(topic, event, payload) ⇒ Object
Constructor Details
#initialize(redis_url: 'redis://localhost:6379', phoenix_class: 'Chat.PubSub') ⇒ Redis
Returns a new instance of Redis.
43 44 45 46 |
# File 'lib/phoenix/pubsub.rb', line 43 def initialize(redis_url: 'redis://localhost:6379', phoenix_class: 'Chat.PubSub') @phoenix_class_name = phoenix_class @redis = ::Redis.new(url: redis_url) end |
Instance Method Details
#publish(topic, event, payload) ⇒ Object
48 49 50 |
# File 'lib/phoenix/pubsub.rb', line 48 def publish topic, event, payload @redis.publish("phx:Elixir.#{@phoenix_class_name}", (topic, event, payload)) end |