Class: ActionCable::SubscriptionAdapter::SolidCable
- Inherits:
-
Base
- Object
- Base
- ActionCable::SubscriptionAdapter::SolidCable
- Includes:
- ChannelPrefix
- Defined in:
- lib/action_cable/subscription_adapter/solid_cable.rb
Defined Under Namespace
Classes: Listener
Instance Method Summary collapse
- #broadcast(channel, payload) ⇒ Object
-
#initialize ⇒ SolidCable
constructor
A new instance of SolidCable.
- #subscribe(channel, callback, success_callback = nil) ⇒ Object
- #unsubscribe(channel, callback) ⇒ Object
Constructor Details
#initialize ⇒ SolidCable
Returns a new instance of SolidCable.
12 13 14 15 |
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 12 def initialize(*) super @listener = nil end |
Instance Method Details
#broadcast(channel, payload) ⇒ Object
17 18 19 20 21 |
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 17 def broadcast(channel, payload) ::SolidCable::Message.broadcast(channel, payload) ::SolidCable::TrimJob.perform_now if ::SolidCable.autotrim? end |
#subscribe(channel, callback, success_callback = nil) ⇒ Object
23 24 25 |
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 23 def subscribe(channel, callback, success_callback = nil) listener.add_subscriber(channel, callback, success_callback) end |
#unsubscribe(channel, callback) ⇒ Object
27 28 29 |
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 27 def unsubscribe(channel, callback) listener.remove_subscriber(channel, callback) end |