Class: Tidewave::BrowserControl::Server

Inherits:
ActionCable::Server::Base
  • Object
show all
Defined in:
lib/tidewave/browser_control.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cable:, logger:) ⇒ Server

Returns a new instance of Server.



153
154
155
156
157
158
159
160
161
162
163
# File 'lib/tidewave/browser_control.rb', line 153

def initialize(cable:, logger:)
  config = ActionCable::Server::Configuration.new
  config.cable = cable
  config.connection_class = -> { Tidewave::BrowserControl::Connection }
  # The origin is validated by the Tidewave middleware before the
  # request reaches this server.
  config.disable_request_forgery_protection = true
  config.logger = logger
  super(config: config)
  @client_registry = ClientRegistry.new
end

Instance Attribute Details

#client_registryObject (readonly)

Registry of client names owned by connections in this process, backing the "hello" name-uniqueness check.



151
152
153
# File 'lib/tidewave/browser_control.rb', line 151

def client_registry
  @client_registry
end