Room control question using socket.io.

Asked 2 years ago, Updated 2 years ago, 91 views

I'm implementing it while studying web messenger, but currently, I've completed the implementation of the conversation between the users. The problem is that when one of the users ends the connection (logout or browser termination), the connection is disconnected and left in the room. So if you reconnect, there is no room information, so you have to talk again.

What I thought was that when I join the room, I save the room information in the db (room name or chat record), and when I access it, I find the room I belong to, and when it exists, I re-join all the chat records.

Or is there another solution, or is there a way to maintain the connection even if it ends?

I'm sorry for the question that's so lame and please answer it.

node.js socket.io mongodb

2022-09-22 21:43

1 Answers

The way you thought about it is correct.

When the conversation starts, create a chat room and record participation information in the chat room on the DB, etc. (Room number, participants)


2022-09-22 21:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.