Module: LanGrove::Handler::SocketBase
Constant Summary
Default
Instance Attribute Summary
#capsule, #config, #key, #logger, #pending_capsule, #protocol, #scheduler, #server, #type
Instance Method Summary
collapse
#assign, #connect, #disconnect, #error, #event_filter, #receive, #reload, #reload_handler, #start, #start_handler, #stop, #stop_handler, #transform, #unique
Instance Method Details
#handle_connect ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/langrove/handler/socket_base.rb', line 9
def handle_connect
@root.trigger( self, :handler, :connect )
connect
@root.trigger( self, :handler, :after_connect )
end
|
#handle_disconnect ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/langrove/handler/socket_base.rb', line 19
def handle_disconnect
@root.trigger( self, :handler, :disconnect )
disconnect
server.disconnect( self )
@root.trigger( self, :handler, :after_disconnect )
end
|
#handle_error(err) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/langrove/handler/socket_base.rb', line 31
def handle_error( err )
@root.trigger( self, :handler, :error )
error( err )
end
|
#handle_receive_data(data) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/langrove/handler/socket_base.rb', line 50
def handle_receive_data( data )
decoded_data = @protocol.decode( data )
if @pending_capsule.nil?
@pending_capsule = decoded_data
@root.trigger( self, :handler, :first_message )
end
@root.trigger( self, :handler, :receive )
receive( decoded_data )
@root.trigger( self, :handler, :after_receive )
end
|
#unbind ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/langrove/handler/socket_base.rb', line 39
def unbind
stop_handler handle_disconnect
end
|