class Rage::Configuration::Cable

def adapter

Other tags:
    Private: -
def adapter
  case config[:adapter]
  when "redis"
    Rage::Cable::Adapters::Redis.new(adapter_config)
  end
end

def adapter_config

Other tags:
    Private: -
def adapter_config
  config.except(:adapter)
end

def config

Other tags:
    Private: -
def config
  @config ||= begin
    config_file = Rage.root.join("config/cable.yml")
    if config_file.exist?
      yaml = ERB.new(config_file.read).result
      YAML.safe_load(yaml, aliases: true, symbolize_names: true)[Rage.env.to_sym] || {}
    else
      {}
    end
  end
end

def initialize

Other tags:
    Private: -
def initialize
  @protocol = Rage::Cable::Protocols::ActioncableV1Json
  @allowed_request_origins = if Rage.env.development? || Rage.env.test?
    /localhost/
  end
end

def middlewares

Other tags:
    Private: -
def middlewares
  @middlewares ||= begin
    origin_middleware = if @disable_request_forgery_protection
      []
    else
      [[Rage::OriginValidator, Array(@allowed_request_origins), nil]]
    end
    origin_middleware + Rage.config.middleware.middlewares.reject do |middleware, _, _|
      middleware == Rage::FiberWrapper
    end
  end
end

def protocol

Returns:
  • (Class) - the protocol class
def protocol
  @protocol
end

def protocol=(protocol)

Other tags:
    Example: Use the built-in Raw WebSocket JSON protocol -
    Example: Use the built-in ActionCable V1 JSON protocol -

Parameters:
  • protocol (:actioncable_v1_json, :raw_websocket_json) -- the protocol symbol
def protocol=(protocol)
  @protocol = case protocol
  when Class
    protocol
  when :actioncable_v1_json
    Rage::Cable::Protocols::ActioncableV1Json
  when :raw_websocket_json
    Rage::Cable::Protocols::RawWebSocketJson
  else
    raise ArgumentError, "Unknown protocol. Supported values are `:actioncable_v1_json` and `:raw_websocket_json`."
  end
end