I am using a simple node.js server to broadcast messages:
var ws = require('websocket.io');
var server = ws.listen(3000);
server.on('connection', function(socket) {
socket.on('message', function(data) {
server.clients.forEach(function(client) {
client.send(data);
});
});
});
The client is written in c++ (cocos2dx framework) and it's working like this:
_websocket = new WebSocket();
_websocket->init(*this, "ws://localhost:3000");
....
_websocket->send(message);
When I measure the latency by sending something to the server and waiting for the response: it's around 80-100ms. The node.js server runs on localhost and I would expect the ping to be around 0-10ms max. Do you know the reason why the ping is so high? Do I have to flush something or is something wrong with the server setup?
Thanks!