You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Hi, Thanks for your report, this is a known issue. In protocol,the connect packet is necessary for initializing a new namespace. But there is one special case: the default namespace '/' which is initialized in serverside by default. So no positive connect packet is needed in clientside. You can patch it for that spacial case.
But anyway, server side connection callback will return the same socket instance for the same namespace, so don't be afraid, no extra recources will be constructed in both sides.
In most cases, this issue doesn't have negative impacts. But it will be a problem if we add some code in "connection" callback and expect it to be executed only once per connection. I thinks it's a reasonable usage for "connection" event.
I'll submit a patch for this special case. Maybe several days later.
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.
The text was updated successfully, but these errors were encountered: