feature/IO-3000-Migrate-MSG-to-Sockets - Major Progress

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-11-14 21:15:59 -08:00
parent e9e1e820a7
commit 1309d8ff65
15 changed files with 337 additions and 109 deletions

View File

@@ -12,6 +12,7 @@ const InstanceManager = require("../utils/instanceMgr").default;
exports.receive = async (req, res) => {
//Perform request validation
const { ioRedis } = req;
logger.log("sms-inbound", "DEBUG", "api", null, {
msid: req.body.SmsMessageSid,
@@ -108,6 +109,11 @@ exports.receive = async (req, res) => {
newMessage,
fcmresp
});
// Broadcast new message to the conversation room
const room = `conversation-${newMessage.conversationid}`;
ioRedis.to(room).emit("new-message", newMessage);
res.status(200).send("");
} catch (e2) {
logger.log("sms-inbound-error", "ERROR", "api", null, {