How can I connect to a nodejs socket.io
server from a cocos2djs
game? I've google all the way to no avail. I tried this but it does not work:
socket = io.connect('http://192.168.254.102:7714');
if ( socket === undefined ) {
cc.log("Could not connect to socket.io");
} else {
socket.on('connect', function() {
socket.emit('join', {username: 'Android Application'})
});
}
I read in the docs that there's a module called SocketIO
for doing that, but there's not enough info on how to use it. Thanks in advance.
undefined
, after searching more I found out that the dev team did not expose SocketIO from cpp to js yet as they did with the other cocos2dx components. A little discuss here: discuss.cocos2d-x.org/t/does-jsb-support-socket-io/10259/4 . I also a found a similar discussion on github, but I cant find it again. \$\endgroup\$ – Anderson Madeira Apr 24 '15 at 19:46