-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.js
55 lines (44 loc) · 975 Bytes
/
global.js
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
var NewestQueue = require('./util.js').NewestQueue;
serverConfig = require('./server.json');
serverConfig.sessionTime = serverConfig.sessionTime;
serverConfig.sessionCheckTime = serverConfig.sessionCheckTime;
//存储房间信息,用户信息
rooms = {}
//根据uid存储用户连接
roomConnections = {};
//根据socket的id存储用户信息
socket2user = {};
//历史消息
newestHistory = new NewestQueue(serverConfig.historyNum);
//在线人数
onlineNum = 0;
issuedType = {
message:'message',
roominfo:'roominfo',
history:'history',
upline:'upline',
downline:'downline',
userinfochange:'userinfochange',
};
costTimes = {
message:[],
enterroom:[],
loadUserSql:[],
loadUserInfoSqlandCache:[],
};
chatMsgType = {
min : 0,
text : 0,
img : 1,
file : 2,
voice : 3,
video : 4,
max : 4,
};
userState = {
online:0,
offline:1,
};
sessions = {};
//to do 设置token过期时间
tokens = {};