Skip to content

Commit 1aaf178

Browse files
Merge pull request #286 from cmu15122/jtromero/fix_webhooks
potential webhook reconnection fix
2 parents 9e6e1d8 + b15d9be commit 1aaf178

File tree

8 files changed

+35
-31
lines changed

8 files changed

+35
-31
lines changed

client/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"react-router-dom": "^6.3.0",
3434
"react-scripts": "^5.0.1",
3535
"react-window": "^1.8.7",
36-
"socket.io-client": "^4.5.1",
36+
"socket.io-client": "^4.8.1",
3737
"styled-components": "^5.3.5",
3838
"typescript": "^4.8.4",
3939
"underscore": "^1.13.4",

client/src/contexts/AllStudentsContext.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ const AllStudentsContextProvider = ({children}: {children: React.ReactNode}) =>
3535
setAllStudents(data.allStudents);
3636
});
3737

38-
const handleVisibilityChange = () => {
39-
if (document.visibilityState === 'visible') {
40-
HomeService.getAllStudents().then((res) => {
41-
setAllStudents(res.data.allStudents);
42-
});
43-
}
44-
};
45-
document.addEventListener('visibilitychange', handleVisibilityChange);
38+
// const handleVisibilityChange = () => {
39+
// if (document.visibilityState === 'visible') {
40+
// HomeService.getAllStudents().then((res) => {
41+
// setAllStudents(res.data.allStudents);
42+
// });
43+
// }
44+
// };
45+
// document.addEventListener('visibilitychange', handleVisibilityChange);
4646
}
4747
}, [userData.isTA]);
4848

client/src/contexts/QueueDataContext.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ const QueueDataContextProvider = ({
6161
setQueueData(data);
6262
});
6363

64-
const handleVisibilityChange = () => {
65-
if (document.visibilityState === 'visible') {
66-
HomeService.getAll().then((res) => {
67-
setQueueData(res.data);
68-
});
69-
}
70-
};
71-
document.addEventListener('visibilitychange', handleVisibilityChange);
64+
// const handleVisibilityChange = () => {
65+
// if (document.visibilityState === 'visible') {
66+
// HomeService.getAll().then((res) => {
67+
// setQueueData(res.data);
68+
// });
69+
// }
70+
// };
71+
// document.addEventListener('visibilitychange', handleVisibilityChange);
7272
}, []);
7373

7474
return (

client/src/contexts/StudentDataContext.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ const StudentDataContextProvider = ({children}: {children: React.ReactNode}) =>
6868
}
6969
});
7070

71-
const handleVisibilityChange = () => {
72-
if (document.visibilityState === 'visible') {
73-
HomeService.getStudentData().then((res) => {
74-
if (res.status === 200 && res.data.andrewID === userData.andrewID) {
75-
setStudentData(res.data);
76-
}
77-
});
78-
}
79-
};
80-
document.addEventListener('visibilitychange', handleVisibilityChange);
71+
// const handleVisibilityChange = () => {
72+
// if (document.visibilityState === 'visible') {
73+
// HomeService.getStudentData().then((res) => {
74+
// if (res.status === 200 && res.data.andrewID === userData.andrewID) {
75+
// setStudentData(res.data);
76+
// }
77+
// });
78+
// }
79+
// };
80+
// document.addEventListener('visibilitychange', handleVisibilityChange);
8181
}
8282
}, [userData.isAuthenticated]);
8383

server/controllers/sockets.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ exports.init = function (server) {
1717
cors: {
1818
origin: config.PROTOCOL + "://" + config.DOMAIN + ":" + config.CLIENT_PORT,
1919
methods: ["GET", "POST"]
20+
},
21+
connectionStateRecovery: {
22+
maxDisconnectionDuration: 2 * 60 * 1000,
23+
skipMiddlewares: true
2024
}
2125
});
2226

@@ -63,7 +67,7 @@ exports.queueData = function (queueData) {
6367
console.log("ERROR: Socket.io is not initialized yet");
6468
return;
6569
}
66-
70+
6771
sio.emit("queueData", {
6872
...queueData
6973
});

server/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"pg": "^8.7.3",
4141
"sequelize": "^6.20.1",
4242
"slack-webhook": "^1.0.0",
43-
"socket.io": "^4.5.1"
43+
"socket.io": "^4.8.1"
4444
},
4545
"devDependencies": {
4646
"@babel/core": "^7.18.2",

0 commit comments

Comments
 (0)