If I do console.log (socket), I get a socket object in firebug. In obj, I could see the property with id , and I could see the id value. But when I do console.log (socket.id), I get undefined. why?
var socket = io(); $(document).ready( function(){ console.log(socket); console.log(socket.id); console.log(socket.ids); $(".click").on("click", function(e){ alert("clicked") socket.emit("clicked", socket.id) $(this).addClass("removeclick"); }) });
ps I could get socket.ids , which is 0, but not socket.id.
jack blank
source share