Class: Faye::WebSocket::RainbowsClient
- Inherits:
-
Rainbows::EventMachine::Client
- Object
- Rainbows::EventMachine::Client
- Faye::WebSocket::RainbowsClient
show all
- Includes:
- Adapter
- Defined in:
- lib/faye/adapters/rainbows_client.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Adapter
#eventsource?, #socket_connection?, #websocket?
Instance Attribute Details
#socket_stream ⇒ Object
Returns the value of attribute socket_stream.
30
31
32
|
# File 'lib/faye/adapters/rainbows_client.rb', line 30
def socket_stream
@socket_stream
end
|
Instance Method Details
#app_call(*args) ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/faye/adapters/rainbows_client.rb', line 37
def app_call(*args)
@env['em.connection'] = self
if args.first == NULL_IO and @hp.content_length == 0 and websocket?
prepare_request_body
else
super
end
end
|
#on_read(data) ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'lib/faye/adapters/rainbows_client.rb', line 46
def on_read(data)
if @state == :body and websocket? and @hp.body_eof?
@state = :websocket
@input.rewind
app_call StringIO.new(@buf)
else
super
end
end
|
#receive_data(data) ⇒ Object
32
33
34
35
|
# File 'lib/faye/adapters/rainbows_client.rb', line 32
def receive_data(data)
return super unless @state == :websocket
socket_stream.receive(data) if socket_stream
end
|
#unbind ⇒ Object
56
57
58
59
60
|
# File 'lib/faye/adapters/rainbows_client.rb', line 56
def unbind
super
ensure
socket_stream.fail if socket_stream
end
|
62
63
64
|
# File 'lib/faye/adapters/rainbows_client.rb', line 62
def (status, , *args)
super unless socket_connection? and status == 101
end
|