Class: DrunkMonkey::Transport::WebSocket
- Inherits:
-
Base
- Object
- Base
- DrunkMonkey::Transport::WebSocket
show all
- Includes:
- Celluloid
- Defined in:
- lib/drunkmonkey/transport.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize, parse_params, #portal
Class Method Details
.resume(request, options = {}) ⇒ Object
67
68
69
70
|
# File 'lib/drunkmonkey/transport.rb', line 67
def self.resume request, options = {}
websocket = super
websocket.handle_connection request
end
|
Instance Method Details
#handle_connection(request) ⇒ Object
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/drunkmonkey/transport.rb', line 72
def handle_connection request
handshake request
@controller.async.fire :open, Actor.current
loop do
Celluloid.sleep 0.001
upstream
downstream
return if @socket.closed?
end
end
|
#push(message) ⇒ Object
83
84
85
|
# File 'lib/drunkmonkey/transport.rb', line 83
def push message
@messages << message
end
|