Is it possible to get the socket.id from the client thats emits something?
Like:
Clientside:
socket.emit("lol", "data")
Server side:
socket.on("lol", function(data) {
// get the socket.id from the client who sended this!!
});
So, I`m making a Tic Tac Toe game in multiplayer. I'm using rooms. In each room there are 2 players. But I need to detect in which room the player is that clicked a field.
I can also explain it like this:
Server side:
player1.on("click", function(data) {
console.log(data + " in room" + playRoom);
});
But this is not working.