We are implementing web messenger using node.js and socket.io.

Asked 2 years ago, Updated 2 years ago, 86 views

I am a beginner who is learning node.js and socket.io for the first time.

If it's a simple chat, there are a lot of data, but the deeper it goes, the harder it becomes to find something.

What I thought was to write a nickname (?) when I signed up, put that nickname as a name space, and create a room by email in it.

test1 = { 'Room 1', 'Room 2', 'Room 3'...} test2 = { 'Room 1', 'Room 2', 'Room 3'...}

I'm thinking about implementing it this way.

If 1 were to talk to 2, I thought about going to the namespace of 2 and getting room information, checking if there is a room in my email, joining if there is a room, and creating an email room in the namespace of 1 if there is no room.

But I don't know if it's a normal and efficient way... I wish I had a guide, but it's hard because I can't find it.It's shameless, but how much guide can you suggest?

node.js socket.io

2022-09-21 14:36

1 Answers

I'm answering after thinking about it because there's no answer.

Each nickname has a list of rooms, and it is strange to find them in the email of the other person (not the other person's nickname). It is recommended to use a unique attribute as an id that distinguishes the user.

I think it would be nice to have each room have its own id, and manage the list of users 1 and 2 that they are talking to (the other person's id + room id). To go deeper, you also need to think about what to do when you talk to each other at the same time.

I hope it was helpful.


2022-09-21 14:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.