feature/IO-3000-messaging-sockets-migrations2 -

- sync send
- fix status events

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-11-20 19:23:35 -08:00
parent 06afd6da5b
commit 15151cb4ac
4 changed files with 92 additions and 30 deletions

View File

@@ -178,6 +178,19 @@ const redisSocketEvents = ({
}
};
const messageAdded = ({ bodyshopId, conversationId, message }) => {
try {
const room = getBodyshopConversationRoom({ bodyshopId, conversationId });
io.to(room).emit("new-message", message);
} catch (error) {
logger.log("Failed to handle new message", "error", "io-redis", null, {
error: error.message,
stack: error.stack
});
}
};
socket.on("message-added", messageAdded);
socket.on("conversation-modified", conversationModified);
socket.on("join-bodyshop-conversation", joinConversationRoom);
socket.on("leave-bodyshop-conversation", leaveConversationRoom);