class ActionCable::SubscriptionAdapter::Redis
:nodoc:
def broadcast(channel, payload)
def broadcast(channel, payload) redis_connection_for_broadcasts.publish(channel, payload) end
def initialize(*)
def initialize(*) super @listener = nil @redis_connection_for_broadcasts = nil end
def listener
def listener @listener || @server.mutex.synchronize { @listener ||= Listener.new(self, @server.event_loop) } end
def redis_connection
def redis_connection self.class.redis_connector.call(@server.config.cable.symbolize_keys.merge(id: identifier)) end
def redis_connection_for_broadcasts
def redis_connection_for_broadcasts @redis_connection_for_broadcasts || @server.mutex.synchronize do @redis_connection_for_broadcasts ||= redis_connection end end
def redis_connection_for_subscriptions
def redis_connection_for_subscriptions redis_connection end
def shutdown
def shutdown @listener.shutdown if @listener end
def subscribe(channel, callback, success_callback = nil)
def subscribe(channel, callback, success_callback = nil) listener.add_subscriber(channel, callback, success_callback) end
def unsubscribe(channel, callback)
def unsubscribe(channel, callback) listener.remove_subscriber(channel, callback) end