Class: AnyCable::Rack::Middleware
- Inherits:
-
Object
- Object
- AnyCable::Rack::Middleware
- Defined in:
- lib/anycable/rack/middleware.rb
Overview
:nodoc:
Constant Summary collapse
- PROTOCOLS =
["actioncable-v1-json", "actioncable-v1-msgpack", "actioncable-unsupported"].freeze
Instance Attribute Summary collapse
-
#coder ⇒ Object
readonly
Returns the value of attribute coder.
-
#header_names ⇒ Object
readonly
Returns the value of attribute header_names.
-
#hub ⇒ Object
readonly
Returns the value of attribute hub.
-
#pinger ⇒ Object
readonly
Returns the value of attribute pinger.
-
#rpc_client ⇒ Object
readonly
Returns the value of attribute rpc_client.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(pinger:, hub:, coder:, rpc_client:, header_names:) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(pinger:, hub:, coder:, rpc_client:, header_names:) ⇒ Middleware
Returns a new instance of Middleware.
19 20 21 22 23 24 25 |
# File 'lib/anycable/rack/middleware.rb', line 19 def initialize(pinger:, hub:, coder:, rpc_client:, header_names:) @pinger = pinger @hub = hub @coder = coder @rpc_client = rpc_client @header_names = header_names end |
Instance Attribute Details
#coder ⇒ Object (readonly)
Returns the value of attribute coder.
13 14 15 |
# File 'lib/anycable/rack/middleware.rb', line 13 def coder @coder end |
#header_names ⇒ Object (readonly)
Returns the value of attribute header_names.
13 14 15 |
# File 'lib/anycable/rack/middleware.rb', line 13 def header_names @header_names end |
#hub ⇒ Object (readonly)
Returns the value of attribute hub.
13 14 15 |
# File 'lib/anycable/rack/middleware.rb', line 13 def hub @hub end |
#pinger ⇒ Object (readonly)
Returns the value of attribute pinger.
13 14 15 |
# File 'lib/anycable/rack/middleware.rb', line 13 def pinger @pinger end |
#rpc_client ⇒ Object (readonly)
Returns the value of attribute rpc_client.
13 14 15 |
# File 'lib/anycable/rack/middleware.rb', line 13 def rpc_client @rpc_client end |
Instance Method Details
#call(env) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/anycable/rack/middleware.rb', line 27 def call(env) return not_found unless websocket?(env) rack_hijack(env) listen_socket(env) [-1, {}, []] end |