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
#async_connection?, #eventsource?, #websocket?
Instance Attribute Details
#socket_stream ⇒ Object
Returns the value of attribute socket_stream.
31
32
33
|
# File 'lib/faye/adapters/rainbows_client.rb', line 31
def socket_stream
@socket_stream
end
|
Instance Method Details
#app_call(*args) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/faye/adapters/rainbows_client.rb', line 38
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
47
48
49
50
51
52
53
54
55
|
# File 'lib/faye/adapters/rainbows_client.rb', line 47
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
33
34
35
36
|
# File 'lib/faye/adapters/rainbows_client.rb', line 33
def receive_data(data)
return super unless @state == :websocket
socket_stream.receive(data) if socket_stream
end
|
#unbind ⇒ Object
57
58
59
60
61
|
# File 'lib/faye/adapters/rainbows_client.rb', line 57
def unbind
super
ensure
socket_stream.fail if socket_stream
end
|
63
64
65
|
# File 'lib/faye/adapters/rainbows_client.rb', line 63
def (*args)
super unless async_connection?
end
|