Class: EventMachine::WebsocketConnection
- Inherits:
-
HttpConnection
- Object
- HttpConnection
- EventMachine::WebsocketConnection
- Defined in:
- lib/em-ws-request/client.rb
Instance Method Summary collapse
- #post_init ⇒ Object
- #receive_data(data) ⇒ Object
- #setup_request(method, options = {}, c = nil) ⇒ Object
Instance Method Details
#post_init ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/em-ws-request/client.rb', line 9 def post_init super @p. = proc do if not client.continue? if client.state == :upgrade client.state = :stream client.succeed else client.state = :finished client.on_request_complete end end end end |
#receive_data(data) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/em-ws-request/client.rb', line 24 def receive_data(data) if client.state == :stream client.receive(data) else super(data) upgrade_data = @p.upgrade_data receive_data(upgrade_data) unless upgrade_data.empty? end end |
#setup_request(method, options = {}, c = nil) ⇒ Object
3 4 5 6 7 |
# File 'lib/em-ws-request/client.rb', line 3 def setup_request(method, = {}, c = nil) c ||= WebsocketClient.new(self, WsClientOptions.new(@uri, , method)) @deferred ? activate_connection(c) : finalize_request(c) c end |