Class: Rev::WebSocket
- Inherits:
-
TCPSocket
- Object
- TCPSocket
- Rev::WebSocket
show all
- Defined in:
- lib/rev/websocket.rb,
lib/rev/websocket/spec.rb
Overview
Defined Under Namespace
Modules: Spec75, Spec76
Classes: DummyIO
Constant Summary
collapse
- HAVE_ENCODING =
false
- FRAME_START =
"\x00"
- FRAME_END =
"\xFF"
- HTTP11_PRASER =
HTTP11_PRASER = Mongrel::HttpParser
Thin::HttpParser
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(socket) ⇒ WebSocket
Returns a new instance of WebSocket.
55
56
57
58
59
60
61
62
|
# File 'lib/rev/websocket.rb', line 55
def initialize(socket)
super
@state = :process_handshake
@data = ::IO::Buffer.new
@http11 = HTTP11_PRASER.new
@http11_nbytes = 0
@request = {DummyIO::KEY => DummyIO.new}
end
|
Instance Attribute Details
#request ⇒ Object
Returns the value of attribute request.
25
26
27
|
# File 'lib/rev/websocket.rb', line 25
def request
@request
end
|
Instance Method Details
#on_error(reason) ⇒ Object
22
23
|
# File 'lib/rev/websocket.rb', line 22
def on_error(reason)
end
|
#on_message(data) ⇒ Object
19
20
|
# File 'lib/rev/websocket.rb', line 19
def on_message(data)
end
|
#on_open ⇒ Object
16
17
|
# File 'lib/rev/websocket.rb', line 16
def on_open
end
|
#on_read(data) ⇒ Object
70
71
72
73
|
# File 'lib/rev/websocket.rb', line 70
def on_read(data)
@data << data
dispatch
end
|
#on_readable ⇒ Object
64
65
66
67
68
|
# File 'lib/rev/websocket.rb', line 64
def on_readable
super
rescue
close
end
|
#send_message(data) ⇒ Object