Answer the question
In order to leave comments, you need to log in
What is the problem of passing data to the server via socket.io?
What is the problem of passing data to the server via socket.io?
Server code:
socket.on('user_info', function(username){
console.log('username: ' + username);
});
socket.on('connect', function (data) {
console.log(username);
if(username != 1) {
socket.emit('user_info', { username : username});
}
else {
console.log('Cant autheticate: You are not logged in.');
}
});
Answer the question
In order to leave comments, you need to log in
you pass in an object... you
try to output it as a string....
...
you get what it is.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question