on the server side i got
socket.on('chat', function (data) {
io.sockets.socket(data.clientid).emit('chat', {
msg: data.msg,
senderid : senderid
});
});
How can I get the get the senderid without the sender having to post their clientid through with the message?
It turns out I can just use socket.id of the user sending through a msg to get their clientid, such as:
Originally I thought I could just fetch the clientid by doing :
But clientid will be the last person who connected in this instance, not the last person who sent through a chat