-
Notifications
You must be signed in to change notification settings - Fork 1
/
note
101 lines (88 loc) · 1.83 KB
/
note
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
classes
ServerEnd
id
_sid [Deprecated]
type
app:Application
socket:io.Socket
timeout [Deprecated]
init(options)
onLogin(options)
onDisconnecting()
onReconnect() [Deprecated]
disconnect(options)
onSend (sessions, router, data, callback)
onMessage(sender, router, data, callback)
onCommand(command, params, callback)
send(sessions, router, data, callback)
command(command, params, callback)
processMessage(sender, router, data, callback)
display()
Session
id
_id
_cid
app:Application
connector:ServerEnd
init(options)
display()
ClientSession
id
_id
_cid
app:Application
socket:io.Socket
attributes:{key:value} [Not Avail]
localAttributes:{key:value} [Not Avail]
backEnds { typeName : ServerEnd }
init(options)
onLogin(options)
onDisconnecting()
disconnect(options)
onMessage(router, data, callback)
send(router, data, callback)
setBackEnd(type, serverEnd)
display()
SessionManager
app:Application
sessions:Array(Session|ClientSession)
init(options)
create(socket)
create2(options)
onConnect(socket)
send(sessions, router, data, callback)
drop(sessions)
filter(func)
get(_id)
childrenDisplay()
ServerManager
app:Application
servers:Array(ServerEnd)
init(options)
create(data, socket)
onConnect(socket)
login(config, socket, options)
drop(servers)
filter(func)
get(id)
childrenDisplay()
Application
pid
servers:[]
loadConfig(id)
loadConfigFile(file, options)
loadMasterConfig(options)
init(options)
start(options)
onStart()
isConnector()
isMaster()
startConnector()
startBackEndServer()
startMaster()
onMessage(router, func)
onCommand(command, func)
connectBackEnd(id)
display()
TODO:
1. 全局异常处理目前使用process.on('uncatchexception')来处理,100%不合适,需要寻找合适方法。