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
Instance Method Summary
collapse
Constructor Details
#initialize(connection, request, debug = false) ⇒ Handler
Returns a new instance of Handler.
8
9
10
11
12
13
|
# File 'lib/em-websocket/handler.rb', line 8
def initialize(connection, request, debug = false)
@connection, @request = connection, request
@debug = debug
@state = :handshake
initialize_framing
end
|
Instance Attribute Details
#request ⇒ Object
Returns the value of attribute request.
6
7
8
|
# File 'lib/em-websocket/handler.rb', line 6
def request
@request
end
|
#state ⇒ Object
Returns the value of attribute state.
6
7
8
|
# File 'lib/em-websocket/handler.rb', line 6
def state
@state
end
|
Instance Method Details
#close_websocket(code, body) ⇒ Object
31
32
33
|
# File 'lib/em-websocket/handler.rb', line 31
def close_websocket(code, body)
end
|
#handshake ⇒ Object
22
23
24
|
# File 'lib/em-websocket/handler.rb', line 22
def handshake
end
|
#ping ⇒ Object
40
41
42
43
|
# File 'lib/em-websocket/handler.rb', line 40
def ping
false
end
|
#pingable? ⇒ Boolean
45
46
47
48
|
# File 'lib/em-websocket/handler.rb', line 45
def pingable?
false
end
|
#receive_data(data) ⇒ Object
26
27
28
29
|
# File 'lib/em-websocket/handler.rb', line 26
def receive_data(data)
@data << data
process_data(data)
end
|
#run ⇒ Object
15
16
17
18
19
|
# File 'lib/em-websocket/handler.rb', line 15
def run
@connection.send_data handshake
@state = :connected
@connection.trigger_on_open
end
|
#unbind ⇒ Object
35
36
37
38
|
# File 'lib/em-websocket/handler.rb', line 35
def unbind
@state = :closed
@connection.trigger_on_close
end
|