Class: Mooncell::Protocol::WebSocket Private
- Inherits:
-
Object
- Object
- Mooncell::Protocol::WebSocket
- Includes:
- Mooncell::Protocol
- Defined in:
- lib/mooncell/protocol/websocket.rb,
lib/mooncell/protocol/websocket/server.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
WebSocket Protocol
Defined Under Namespace
Classes: Server
Constant Summary collapse
- BAD_RESPONSE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[ 400, {}, [] ].freeze
Instance Method Summary collapse
-
#call(env) ⇒ Object
private
Implement Rack interface.
-
#initialize(app) ⇒ WebSocket
constructor
private
Create protocol instance.
-
#options ⇒ Hash
private
Return options.
-
#start ⇒ Object
private
Start Server.
Methods included from Mooncell::Protocol
Constructor Details
#initialize(app) ⇒ WebSocket
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create protocol instance
TODO: Generalize protocol behaviors
27 28 29 |
# File 'lib/mooncell/protocol/websocket.rb', line 27 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Implement Rack interface
45 46 47 48 49 |
# File 'lib/mooncell/protocol/websocket.rb', line 45 def call(env) return BAD_RESPONSE unless Faye::WebSocket.websocket?(env) WebSocket::Server.new(app, env).rack_response end |
#options ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return options
57 58 59 60 61 |
# File 'lib/mooncell/protocol/websocket.rb', line 57 def { Port: app.configuration.port } end |
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Start Server
35 36 37 |
# File 'lib/mooncell/protocol/websocket.rb', line 35 def start Rack::Handler.default.run(self, ) end |