Class: Rubko::Socket
- Inherits:
-
Controller
- Object
- Controller
- Rubko::Socket
- Defined in:
- lib/rubko/socket.rb
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
- #compressible? ⇒ Boolean
- #finalize ⇒ Object
-
#initialize ⇒ Socket
constructor
A new instance of Socket.
Methods inherited from Controller
Methods included from Base
#camelize, #httpGet, #init, #jsonParse, #loadController, #loadFile, #loadModel, #loadPlugin, #loadView, #method_missing, #uncamelize
Constructor Details
#initialize ⇒ Socket
Returns a new instance of Socket.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rubko/socket.rb', line 7 def initialize(*) super if Faye::WebSocket.websocket?(env) @ws = Faye::WebSocket.new env#, [], ping: 10*60 @ws.onclose = -> event { p [:close, event.code, event.reason] @ws = nil } end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rubko::Base
Instance Method Details
#compressible? ⇒ Boolean
22 |
# File 'lib/rubko/socket.rb', line 22 def compressible?; false end |
#finalize ⇒ Object
18 19 20 |
# File 'lib/rubko/socket.rb', line 18 def finalize self.status, self.headers, self.body = *@ws.rack_response if @ws end |