feature/IO-3000-Migrate-MSG-to-Sockets - Major Progress
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -14,6 +14,7 @@ const gqlClient = require("../graphql-client/graphql-client").client;
|
||||
|
||||
exports.send = (req, res) => {
|
||||
const { to, messagingServiceSid, body, conversationid, selectedMedia, imexshopid } = req.body;
|
||||
const { ioRedis } = req;
|
||||
|
||||
logger.log("sms-outbound", "DEBUG", req.user.email, null, {
|
||||
messagingServiceSid: messagingServiceSid,
|
||||
@@ -59,6 +60,13 @@ exports.send = (req, res) => {
|
||||
conversationid: newMessage.conversationid || ""
|
||||
};
|
||||
|
||||
// TODO Verify
|
||||
// const messageData = response.insert_messages.returning[0];
|
||||
|
||||
// Broadcast new message to conversation room
|
||||
const room = `conversation-${conversationid}`;
|
||||
ioRedis.to(room).emit("new-message", newMessage);
|
||||
|
||||
admin.messaging().send({
|
||||
topic: `${imexshopid}-messaging`,
|
||||
data
|
||||
|
||||
Reference in New Issue
Block a user