Class: ActionCable::SubscriptionAdapter::SolidCable

Inherits:
Base
  • Object
show all
Includes:
ChannelPrefix
Defined in:
lib/action_cable/subscription_adapter/solid_cable.rb

Defined Under Namespace

Classes: Listener

Instance Method Summary collapse

Constructor Details

#initializeSolidCable

Returns a new instance of SolidCable.



13
14
15
16
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 13

def initialize(*)
  super
  @listener = nil
end

Instance Method Details

#broadcast(channel, payload) ⇒ Object



18
19
20
21
22
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 18

def broadcast(channel, payload)
  ::SolidCable::Message.broadcast(channel, payload)

  ::SolidCable::TrimJob.perform_now if ::SolidCable.autotrim?
end

#subscribe(channel, callback, success_callback = nil) ⇒ Object



24
25
26
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 24

def subscribe(channel, callback, success_callback = nil)
  listener.add_subscriber(channel, callback, success_callback)
end

#unsubscribe(channel, callback) ⇒ Object



28
29
30
# File 'lib/action_cable/subscription_adapter/solid_cable.rb', line 28

def unsubscribe(channel, callback)
  listener.remove_subscriber(channel, callback)
end