How to communicate with sockets?(C++)

Hi I am stuck at sending and receiving messages to a node.js server. Here are parts of the code on the server:

NODE JS (Socket.IO v1.2.1)

var app = require('express')();
var http = require('http').Server(app);
var io=require('socket.io')(http);

 ///
io.on('connection', function(socket){
  console.log('a user connected');
  socket.emit('status', 'my test message');
  
  io.on('disconnect', function(){
    console.log('user disconnected');
  });
  
  io.on('tap', function(msg){
    console.log('user tapped with message' + msg);
    socket.emit('status', {value: 'user tapped with message' + msg});
  });
  
});//*/

Here is parts of the code on client side:

HEADER file(.h)

//SOCKET
/*// Socket.io event of event listener*/
void onReceiveEvent (cocos2d::network::SIOClient* client, const std::string &data);

// SIODelegate
virtual void onConnect(cocos2d::network::SIOClient* client)
{CCLOG("ON CONNECT");};
virtual void onMessage(cocos2d::network::SIOClient* client, const std::string &data)
{CCLOG("ON MESSAGE");};
virtual void onClose(cocos2d::network::SIOClient* client)
{CCLOG("ON CLOSE");};
virtual void onError(cocos2d::network::SIOClient* client, const std::string &data)
{CCLOG("ON ERROR");};//*/

CPP file(.cpp)

bool MultiScene::init()
{
    if ( !Layer::init() )
    {
        return false;
    }
    
.
.
.
    //CLIENT
    client=network::SocketIO::getInstance()->connect(serverPath, *this);
    client->on("status", CC_CALLBACK_2(MultiScene::onReceiveEvent, this));
    
    
    //login();
    
    return true;
}

.
.
.

void MultiScene::onReceiveEvent(network::SIOClient *client, const std::string &data)
{
    CCLOG("ON RECIEVE");
    CCLOG("ON RECIEVE: %s",data.c_str());
}

Problem: No message is recieved or sent and the log shows that the onClose() function is called and onConnect never called?

LOG:

{
	gl.supports_vertex_array_object: true
	cocos2d.x.version: cocos2d-x 3.3
	gl.vendor: Apple Inc.
	gl.supports_PVRTC: true
	gl.renderer: Apple Software Renderer
	cocos2d.x.compiled_with_profiler: false
	gl.max_texture_size: 4096
	gl.supports_ETC1: false
	gl.supports_BGRA8888: false
	cocos2d.x.build_type: DEBUG
	gl.supports_discard_framebuffer: true
	gl.supports_NPOT: true
	gl.supports_ATITC: false
	gl.max_samples_allowed: 4
	gl.max_texture_units: 8
	cocos2d.x.compiled_with_gl_state_cache: true
	gl.supports_S3TC: false
	gl.version: OpenGL ES 2.0 APPLE-10.3.0
}


libpng warning: iCCP: known incorrect sRGB profile
2015-01-05 13:23:14.694 BattleDigits iOS[2277:70425] cocos2d: surface size: 1334x750
2015-01-05 13:23:14.694 BattleDigits iOS[2277:70425] cocos2d: surface size: 1334x750
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
SIOClientImpl::init() successful
SIOClientImpl::handshake() called
SIOClientImpl::handshake() waiting
SIOClientImpl::handshakeResponse() called
handshake completed
response code: 200
SIOClientImpl::handshake() succeeded
SIOClientImpl::handshake() dump data: 97:0{"sid":"bGG3_PZgFVj3Fb9pAAAA","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}
SIOClientImpl::openSocket() called
[WebSocket::init] _host: 192.168.128.99, _port: 3000, _path: /socket.io/1/websocket/97
[1420424607:7282] NOTICE: Initial logging level 7
[1420424607:7282] NOTICE: Library version: 1.3 2567816
[1420424607:7282] NOTICE:  Started with daemon pid 0
[1420424607:7282] NOTICE:  static allocation: 4472 + (16 x 256 fds) = 8568 bytes
ON CLOSE

How may I fix this issue?

Have you managed to solve this? :blush: