IO-2924-Refactor-Production-board-to-use-Socket-Provider: Finalize
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -80,10 +80,6 @@ const redisSocketEvents = (io, { addUserToRoom, getUsersInRoom, removeUserFromRo
|
|||||||
// Register room and broadcasting events
|
// Register room and broadcasting events
|
||||||
registerRoomAndBroadcastEvents(socket);
|
registerRoomAndBroadcastEvents(socket);
|
||||||
registerUpdateEvents(socket);
|
registerUpdateEvents(socket);
|
||||||
// Handle socket disconnection
|
|
||||||
socket.on("disconnect", async () => {
|
|
||||||
createLogEvent(socket, "DEBUG", `User disconnected.`);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const authMiddleware = (socket, next) => {
|
const authMiddleware = (socket, next) => {
|
||||||
@@ -97,7 +93,7 @@ const redisSocketEvents = (io, { addUserToRoom, getUsersInRoom, removeUserFromRo
|
|||||||
next();
|
next();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
next(new Error("Authentication error", JSON.stringify(error)));
|
next(new Error(`Authentication error: ${error.message}`));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
next(new Error("Authentication error - no authorization token."));
|
next(new Error("Authentication error - no authorization token."));
|
||||||
@@ -105,7 +101,6 @@ const redisSocketEvents = (io, { addUserToRoom, getUsersInRoom, removeUserFromRo
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Uncaught connection error:::", error);
|
console.log("Uncaught connection error:::", error);
|
||||||
logger.log("websocket-connection-error", "error", null, null, {
|
logger.log("websocket-connection-error", "error", null, null, {
|
||||||
token: socket.handshake.auth.token,
|
|
||||||
...error
|
...error
|
||||||
});
|
});
|
||||||
next(new Error(`Authentication error ${error}`));
|
next(new Error(`Authentication error ${error}`));
|
||||||
|
|||||||
Reference in New Issue
Block a user