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.



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