Skip to content

Commit

Permalink
fix(analysis): Check before updating sockets data
Browse files Browse the repository at this point in the history
  • Loading branch information
HagerDakroury committed Jul 22, 2021
1 parent afbad1d commit a0b1650
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions analysis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,24 @@ io.on("connection", (socket: any) => {
var meeting = data.meeting;
var student = data.username;

if (student) {
console.log(
"socket: " +
socket.id +
" of user: " +
student +
" connected to meeting:" +
meeting
);

if (student && meeting) {
socket.join(data.meeting + data.username);
sockets[socket.id] = { meeting: data.meeting, username: data.username };
console.log(
"socket: " +
socket.id +
"of user:+" +
" of user: " +
student +
"connected to meeting:" +
" connected to meeting:" +
meeting
);
} else socket.join(data.meeting);
Expand Down Expand Up @@ -82,7 +91,7 @@ io.on("connection", (socket: any) => {

socket.on("disconnect", () => {
var socketId = socket.id;
if (socketId in sockets) {
if (socketId in sockets && student && meeting) {
var meeting = socketId.meeting;
var student = socketId.username;
var emotion = emotions[meeting][student];
Expand Down

0 comments on commit a0b1650

Please sign in to comment.