Class: AnyCable::Rack::Middleware
- Inherits:
-
Object
- Object
- AnyCable::Rack::Middleware
- Defined in:
- lib/anycable/rack/middleware.rb
Overview
:nodoc:
Constant Summary collapse
- PROTOCOLS =
%w[actioncable-v1-json actioncable-v1-ext-json actioncable-v1-msgpack actioncable-unsupported actioncable-v1-protobuf].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.
20 21 22 23 24 25 26 |
# File 'lib/anycable/rack/middleware.rb', line 20 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.
14 15 16 |
# File 'lib/anycable/rack/middleware.rb', line 14 def coder @coder end |
#header_names ⇒ Object (readonly)
Returns the value of attribute header_names.
14 15 16 |
# File 'lib/anycable/rack/middleware.rb', line 14 def header_names @header_names end |
#hub ⇒ Object (readonly)
Returns the value of attribute hub.
14 15 16 |
# File 'lib/anycable/rack/middleware.rb', line 14 def hub @hub end |
#pinger ⇒ Object (readonly)
Returns the value of attribute pinger.
14 15 16 |
# File 'lib/anycable/rack/middleware.rb', line 14 def pinger @pinger end |
#rpc_client ⇒ Object (readonly)
Returns the value of attribute rpc_client.
14 15 16 |
# File 'lib/anycable/rack/middleware.rb', line 14 def rpc_client @rpc_client end |
Instance Method Details
#call(env) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/anycable/rack/middleware.rb', line 28 def call(env) return not_found unless websocket?(env) rack_hijack(env) listen_socket(env) [-1, {}, []] end |