Class: Rage::Configuration::Cable
- Inherits:
-
Object
- Object
- Rage::Configuration::Cable
- Defined in:
- lib/rage/configuration.rb
Instance Attribute Summary collapse
-
#allowed_request_origins ⇒ Array<Regexp>, ...
Restrict the server to only accept requests from specified origins.
-
#disable_request_forgery_protection ⇒ Boolean
Disable request forgery protection for WebSocket connections to allow requests from any origin.
Instance Method Summary collapse
-
#protocol ⇒ Class
Returns the protocol the server will use.
-
#protocol=(protocol) ⇒ Object
Specify the protocol the server will use.
Instance Attribute Details
#allowed_request_origins ⇒ Array<Regexp>, ...
Restrict the server to only accept requests from specified origins. The origins can be strings or regular expressions. Defaults to /localhost/ in development and test environments.
530 531 532 |
# File 'lib/rage/configuration.rb', line 530 def allowed_request_origins @allowed_request_origins end |
#disable_request_forgery_protection ⇒ Boolean
Disable request forgery protection for WebSocket connections to allow requests from any origin.
530 |
# File 'lib/rage/configuration.rb', line 530 attr_accessor :allowed_request_origins, :disable_request_forgery_protection |
Instance Method Details
#protocol ⇒ Class
Returns the protocol the server will use.
542 543 544 |
# File 'lib/rage/configuration.rb', line 542 def protocol @protocol end |
#protocol=(protocol) ⇒ Object
Specify the protocol the server will use. Supported values include :actioncable_v1_json and :raw_websocket_json. Defaults to :actioncable_v1_json.
556 557 558 559 560 561 562 563 564 565 566 567 |
# File 'lib/rage/configuration.rb', line 556 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 |