I want to connect to a Node.js server using Socket.io.
my server is simple and it’s ok on html (js) client!
but when I change html to cocos2d-x and want to connect cocos2d-x to the server, it connects to the server and then disconnects (closes the connection) immediately!
this is the error code:
Websocket error received: 1
from this exception: WS_MSG_TO_UITHREAD_CLOSE
my client code is SocketIOTestLayer class on cocos2d-x socket.io examples.(having _sioClient, _sioEndpoint;)
and this is my simple Node.js!
var port = 3000;
var io = require(‘socket.io’).listen(port);
console.log("Listening on port " + port);
/* Socket.IO events */
console.log("test text event received. "+msg);
thanks a lot…