2017-07-16 13:10:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-30 01:18:35 -04:00
|
|
|
require_relative "inline"
|
2016-01-21 19:43:51 -05:00
|
|
|
|
|
|
|
module ActionCable
|
|
|
|
module SubscriptionAdapter
|
|
|
|
class Async < Inline # :nodoc:
|
|
|
|
private
|
2016-01-24 12:23:27 -05:00
|
|
|
def new_subscriber_map
|
2016-03-01 19:50:19 -05:00
|
|
|
AsyncSubscriberMap.new(server.event_loop)
|
2016-01-21 19:43:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
class AsyncSubscriberMap < SubscriberMap
|
2016-03-01 19:50:19 -05:00
|
|
|
def initialize(event_loop)
|
|
|
|
@event_loop = event_loop
|
|
|
|
super()
|
|
|
|
end
|
|
|
|
|
2016-01-21 19:43:51 -05:00
|
|
|
def add_subscriber(*)
|
2016-03-01 19:50:19 -05:00
|
|
|
@event_loop.post { super }
|
2016-01-21 19:43:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def invoke_callback(*)
|
2016-03-01 19:50:19 -05:00
|
|
|
@event_loop.post { super }
|
2016-01-21 19:43:51 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|