Class: Firehose::Rack::Consumer::WebSocket
- Inherits:
-
Object
- Object
- Firehose::Rack::Consumer::WebSocket
- Defined in:
- lib/firehose/rack/consumer/web_socket.rb
Defined Under Namespace
Classes: DefaultHandler, Handler, MultiplexingHandler
Class Method Summary collapse
-
.request?(env) ⇒ Boolean
Determine if the rack request is a WebSocket request.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Setup a handler for the websocket connection.
Class Method Details
.request?(env) ⇒ Boolean
Determine if the rack request is a WebSocket request.
21 22 23 |
# File 'lib/firehose/rack/consumer/web_socket.rb', line 21 def self.request?(env) Faye::WebSocket.websocket?(env) end |
Instance Method Details
#call(env) ⇒ Object
Setup a handler for the websocket connection.
10 11 12 13 14 15 16 17 18 |
# File 'lib/firehose/rack/consumer/web_socket.rb', line 10 def call(env) ws = Faye::WebSocket.new(env) if Consumer.multiplexing_request?(env) MultiplexingHandler.new(ws) else DefaultHandler.new(ws) end ws.rack_response end |