ActionCable::Server::Configuration (original) (raw)
Methods
N
P
Attributes
[RW] | allow_same_origin_as_host |
---|---|
[RW] | allowed_request_origins |
[RW] | cable |
[RW] | connection_class |
[RW] | disable_request_forgery_protection |
[RW] | filter_parameters |
[RW] | health_check_application |
[RW] | health_check_path |
[RW] | log_tags |
[RW] | logger |
[RW] | mount_path |
[RW] | precompile_assets |
[RW] | url |
[RW] | worker_pool_size |
Class Public methods
new()Link
def initialize @log_tags = []
@connection_class = -> { ActionCable::Connection::Base } @worker_pool_size = 4
@disable_request_forgery_protection = false @allow_same_origin_as_host = true @filter_parameters = []
@health_check_application = ->(env) { [200, { Rack::CONTENT_TYPE => "text/html", "date" => Time.now.httpdate }, []] } end
Instance Public methods
pubsub_adapter()Link
Returns constant of subscription adapter specified in config/cable.yml. If the adapter cannot be found, this will default to the Redis adapter. Also makes sure proper dependencies are required.
def pubsub_adapter adapter = (cable.fetch("adapter") { "redis" })
path_to_adapter = "action_cable/subscription_adapter/#{adapter}" begin require path_to_adapter rescue LoadError => e
if e.path == path_to_adapter
raise e.class, "Could not load the '#{adapter}' Action Cable pubsub adapter. Ensure that the adapter is spelled correctly in config/cable.yml and that you've added the necessary adapter gem to your Gemfile.", e.backtrace
else
raise e.class, "Error loading the '#{adapter}' Action Cable pubsub adapter. Missing a gem it depends on? #{e.message}", e.backtrace
end
end
adapter = adapter.camelize adapter = "PostgreSQL" if adapter == "Postgresql" "ActionCable::SubscriptionAdapter::#{adapter}".constantize end