Class: EventMachine::WebSocket::Handler
- Inherits:
-
Object
- Object
- EventMachine::WebSocket::Handler
show all
- Includes:
- Debugger
- Defined in:
- lib/em-websocket/handler.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(connection, debug = false) ⇒ Handler
Returns a new instance of Handler.
37
38
39
40
41
42
|
# File 'lib/em-websocket/handler.rb', line 37
def initialize(connection, debug = false)
@connection = connection
@debug = debug
@state = :connected
initialize_framing
end
|
Instance Attribute Details
#request ⇒ Object
Returns the value of attribute request.
35
36
37
|
# File 'lib/em-websocket/handler.rb', line 35
def request
@request
end
|
#state ⇒ Object
Returns the value of attribute state.
35
36
37
|
# File 'lib/em-websocket/handler.rb', line 35
def state
@state
end
|
Class Method Details
.klass_factory(version) ⇒ Object
Instance Method Details
#close_websocket(code, body) ⇒ Object
49
50
51
|
# File 'lib/em-websocket/handler.rb', line 49
def close_websocket(code, body)
end
|
#ping ⇒ Object
64
65
66
67
|
# File 'lib/em-websocket/handler.rb', line 64
def ping
false
end
|
#pingable? ⇒ Boolean
69
70
71
72
|
# File 'lib/em-websocket/handler.rb', line 69
def pingable?
false
end
|
#receive_data(data) ⇒ Object
44
45
46
47
|
# File 'lib/em-websocket/handler.rb', line 44
def receive_data(data)
@data << data
process_data(data)
end
|
#unbind ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/em-websocket/handler.rb', line 53
def unbind
@state = :closed
@close_info = defined?(@close_info) ? @close_info : {
:code => 1006,
:was_clean => false,
}
@connection.trigger_on_close(@close_info )
end
|