If we add some log inside connection event handler, like
io.on('connection', function(){
console.log('connection.');
});
It will output twice.
After a briefly investigation, I found socket.io cpp client sent a "connect" packet to the server after connection has been established. Server side seems to recognize it as a new connection. So "connection" event triggered twice.
Currently, I deleted
from sio_socket.cpp (line 269). Then the second "connection" is gone. But I'm not sure if the "connect" packet is necessary or not.
If we add some log inside connection event handler, like
It will output twice.
After a briefly investigation, I found socket.io cpp client sent a "connect" packet to the server after connection has been established. Server side seems to recognize it as a new connection. So "connection" event triggered twice.
Currently, I deleted
m_client->send(p);from sio_socket.cpp (line 269). Then the second "connection" is gone. But I'm not sure if the "connect" packet is necessary or not.