Answer the question
In order to leave comments, you need to log in
How to deal with individual sockets in socket.io?
Hello.
There is such a Socket.io room in which there are two users. The first column always shows
its name (already implemented), but the second column should show the name of the second socket.
But I don't know how to transfer the username of one user to another, please help.
This is how I connect the socket to the room and assign my name to the player1 variable,
which is shown in the first column.
socket.on('JoinToBet', data => {
socket.join(data.url)
socket.emit('Players', {
player1: session.user.login,
player2: // как узнать???
})
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question