Class: ActionCable::SubscriptionAdapter::Inline

Inherits:
Base
  • Object
show all
Defined in:
lib/action_cable/subscription_adapter/inline.rb

Overview

:nodoc:

Direct Known Subclasses

Async

Instance Method Summary collapse

Methods inherited from Base

#identifier

Constructor Details

#initializeInline

Returns a new instance of Inline.



8
9
10
11
12
# File 'lib/action_cable/subscription_adapter/inline.rb', line 8

def initialize(*)
  super
  @mutex = Mutex.new
  @subscriber_map = nil
end

Instance Method Details

#broadcast(channel, payload) ⇒ Object



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

def broadcast(channel, payload)
  subscriber_map.broadcast(channel, payload)
end

#shutdownObject



26
27
28
# File 'lib/action_cable/subscription_adapter/inline.rb', line 26

def shutdown
  # nothing to do
end

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



18
19
20
# File 'lib/action_cable/subscription_adapter/inline.rb', line 18

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

#unsubscribe(channel, callback) ⇒ Object



22
23
24
# File 'lib/action_cable/subscription_adapter/inline.rb', line 22

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