Nextrek
Diff Revisions
1121
vs
1122
for /socketIO/index.js
|
@@ -9,7 +9,7 @@ |
9 |
9 |
|
const Chat = ChatSingleton.instance; |
10 |
10 |
|
|
11 |
11 |
|
|
12 |
|
- |
let connect_sid = undefined; |
|
12 |
+ |
let connect_sid = Date.now(); |
13 |
13 |
|
|
14 |
14 |
|
app.use(session({ |
15 |
15 |
|
secret: 'keyboard cat', |
|
@@ -21,7 +21,7 @@ |
21 |
21 |
|
app.get('/', function (req, res) { |
22 |
22 |
|
console.log(new Date().getTime() + ":[get: /]"); |
23 |
23 |
|
|
24 |
|
- |
connect_sid = req.sessionID; |
|
24 |
+ |
//connect_sid = req.sessionID; |
25 |
25 |
|
console.log('connect_sid', connect_sid); |
26 |
26 |
|
|
27 |
27 |
|
res.sendFile(__dirname + '/public/index.html'); |
|
@@ -30,7 +30,7 @@ |
30 |
30 |
|
app.get('/customer', function (req, res) { |
31 |
31 |
|
console.log(new Date().getTime() + ":[get: /customer]"); |
32 |
32 |
|
|
33 |
|
- |
connect_sid = req.sessionID; |
|
33 |
+ |
//connect_sid = req.sessionID; |
34 |
34 |
|
console.log('connect_sid', connect_sid); |
35 |
35 |
|
|
36 |
36 |
|
res.sendFile(__dirname + '/public/customer.html'); |
|
@@ -39,7 +39,7 @@ |
39 |
39 |
|
app.get('/operator', function (req, res) { |
40 |
40 |
|
console.log(new Date().getTime() + ":[get: /]"); |
41 |
41 |
|
|
42 |
|
- |
connect_sid = req.sessionID; |
|
42 |
+ |
//connect_sid = req.sessionID; |
43 |
43 |
|
console.log('connect_sid', connect_sid); |
44 |
44 |
|
|
45 |
45 |
|
res.sendFile(__dirname + '/public/operator.html'); |
|
@@ -65,7 +65,7 @@ |
65 |
65 |
|
|
66 |
66 |
|
// create user and send updates |
67 |
67 |
|
socket.on(EVENTS.CONNECTION.OPEN, (data) => { |
68 |
|
- |
console.log('CONNECTION:OPEN', data); |
|
68 |
+ |
console.log('CONNECTION:OPEN', data, connect_sid); |
69 |
69 |
|
|
70 |
70 |
|
// create new user |
71 |
71 |
|
Chat.createUser(connect_sid, data.name, data.role); |
|
@@ -119,6 +119,8 @@ |
119 |
119 |
|
|
120 |
120 |
|
|
121 |
121 |
|
socket.on('disconnect', () => { |
|
122 |
+ |
console.log('disconnect', connect_sid); |
|
123 |
+ |
|
122 |
124 |
|
if (!Chat.getUser(connect_sid)) { |
123 |
125 |
|
return |
124 |
126 |
|
} |