added logs to help debug why websocket disconnecting

This commit is contained in:
Martina 2021-01-09 15:04:17 -08:00
parent 1de7e53ac4
commit 1627545a84
3 changed files with 6 additions and 3 deletions

View File

@ -60,6 +60,8 @@ export const init = ({ resource = "", viewer, onUpdate }) => {
console.log(e);
}
console.log(`Received message of type ${type}`);
if (!data) {
return null;
}
@ -68,7 +70,7 @@ export const init = ({ resource = "", viewer, onUpdate }) => {
return null;
}
if (type === "UPDATE" && onUpdate) {
if (type === "UPDATE") {
onUpdate(data);
}
});

View File

@ -154,6 +154,7 @@ export default class ApplicationPage extends React.Component {
// )
// );
// await setAsyncState(newViewerState);
console.log("Handle update viewer called");
this.setState({
viewer: { ...this.state.viewer, ...newViewerState, type: "VIEWER" },

View File

@ -24,6 +24,7 @@ export const create = () => {
clearTimeout(this.pingTimeout);
this.pingTimeout = setTimeout(() => {
NodeLogging.log(`Did not receive ping in time. Disconnecting websocket`);
this.terminate();
}, 30000 + 1000);
});
@ -35,10 +36,9 @@ export const create = () => {
ws.on("close", () => {
global.websocket = null;
console.log(global.websocket);
console.log("Websocket disconnected");
NodeLogging.log(`Websocket disconnected`);
});
console.log("Websocket server started");
NodeLogging.log(`Websocket server started`);
global.websocket = ws;