join room on initialize contact
This commit is contained in:
@@ -62,14 +62,20 @@ function initializeSocket(io) {
|
||||
return;
|
||||
}
|
||||
|
||||
let conversations = [];
|
||||
try {
|
||||
const conversations = await getConversationsForUser(socket.user_id);
|
||||
conversations = await getConversationsForUser(socket.user_id);
|
||||
conversations.push(socket.user_id);
|
||||
socket.join(conversations);
|
||||
} catch (e) {
|
||||
console.error("(socket) Failed to get user conversations");
|
||||
}
|
||||
|
||||
socket.on("join room", (msg) => {
|
||||
console.log("Join room for: ", username, "room: ", msg);
|
||||
socket.join(msg);
|
||||
});
|
||||
|
||||
socket.on("chat message", async (msg, callback) => {
|
||||
const { message, recipient, recipient_id, attachment_urls } = msg;
|
||||
const sender = socket.username;
|
||||
|
||||
Reference in New Issue
Block a user