- Checkpoint

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-09-06 11:53:08 -04:00
parent f28068d0e7
commit 44db8f20e9
4 changed files with 98 additions and 47 deletions

View File

@@ -89,9 +89,11 @@ io.on("connection", (socket) => {
callback(allocations);
});
socket.on("pbs-export-job", (jobid) => {
PbsExportJob(socket, jobid);
});
socket.on("pbs-selected-customer", (selectedCustomerId) => {
createLogEvent(socket, "DEBUG", `User selected customer ID ${selectedCustomerId}`);
socket.selectedCustomerId = selectedCustomerId;
@@ -118,6 +120,23 @@ io.on("connection", (socket) => {
socket.on("disconnect", () => {
createLogEvent(socket, "DEBUG", `User disconnected.`);
});
socket.on("join-bodyshop-room", (bodyshopUUID) => {
socket.join(bodyshopUUID); // Join the room identified by the bodyshop UUID
createLogEvent(socket, "DEBUG", `Client joined bodyshop room: ${bodyshopUUID}`);
});
// Optionally handle leaving the room
socket.on("leave-bodyshop-room", (bodyshopUUID) => {
socket.leave(bodyshopUUID); // Leave the room identified by the bodyshop UUID
createLogEvent(socket, "DEBUG", `Client left bodyshop room: ${bodyshopUUID}`);
});
// Broadcast to specific bodyshop rooms
socket.on("broadcast-to-bodyshop", (bodyshopUUID, message) => {
io.to(bodyshopUUID).emit("bodyshop-message", message);
createLogEvent(socket, "INFO", `Broadcasted message to bodyshop ${bodyshopUUID}`);
});
});
function createLogEvent(socket, level, message) {