B
B
bumbay2014-09-16 22:46:31
Node.js
bumbay, 2014-09-16 22:46:31

How to implement message forwarding between two visitors on socket.io?

I just can't understand the logic of namespace in socket.io.
Can someone solve this issue?
I need to do something like vk.com dialogs but on socket.io.
As I understand it, you need to initially create a namespace (.of()) on the server for all users and then connect?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
bumbay, 2014-10-16
@bumbay

io.sockets.connected

P
Pavel Kilin, 2014-09-17
@borodyadka

I haven't worked with socket.io for a long time, but as far as I remember, there is such a thing called a room (room) .
For each dialogue, you need to create a separate room (as a bonus, we get a group chat, as in the same vk.com). Transfer the room id from the client (see the url of the dialogue in vk), check on the server whether the user has access to it and, depending on this, connect or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question