mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
723375147b
* You can distinguish connection among others with specific `application_name` ```sql SELECT application_name FROM pg_stat_activity; /* application_name ------------------------ psql ActionCable-PID-42 (2 rows) */ ``` * It's possible to customize connection identification with `id` option in `cable.yml` `ActionCable-PID-#{$$}` is the default value * Related tests refactoring * `ActionCable::Server#config.cable` is no mutated anymore inside Redis subscription adapter
34 lines
696 B
Ruby
34 lines
696 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ActionCable
|
|
module SubscriptionAdapter
|
|
class Base
|
|
attr_reader :logger, :server
|
|
|
|
def initialize(server)
|
|
@server = server
|
|
@logger = @server.logger
|
|
end
|
|
|
|
def broadcast(channel, payload)
|
|
raise NotImplementedError
|
|
end
|
|
|
|
def subscribe(channel, message_callback, success_callback = nil)
|
|
raise NotImplementedError
|
|
end
|
|
|
|
def unsubscribe(channel, message_callback)
|
|
raise NotImplementedError
|
|
end
|
|
|
|
def shutdown
|
|
raise NotImplementedError
|
|
end
|
|
|
|
def identifier
|
|
@server.config.cable[:id] ||= "ActionCable-PID-#{$$}"
|
|
end
|
|
end
|
|
end
|
|
end
|