SIOClient::connect(std::string uri) returns a pointer to a "global" client by calling SIOClientRegistry::instance()->getClient(fullpath). If a client to a specific URI already exists, SIOClient::connect returns a pointer to the existing client.
If the user "creates" multiple clients connecting the same server by calling SIOClient::connect, the user actually receives pointers to the same "global" client. The user does not know that without reading the source code. When the user disconnects the clients by calling client->disconnect(), they will all call code:
SIOClient::connect(std::string uri) returns a pointer to a "global" client by calling SIOClientRegistry::instance()->getClient(fullpath). If a client to a specific URI already exists, SIOClient::connect returns a pointer to the existing client.
If the user "creates" multiple clients connecting the same server by calling SIOClient::connect, the user actually receives pointers to the same "global" client. The user does not know that without reading the source code. When the user disconnects the clients by calling client->disconnect(), they will all call code:
void SIOClient::disconnect() { _socket->disconnect(_endpoint); delete this; }
This results in a segfault, because all the client pointers become invalid when the first client calls disconnect.
Possible solution: Use reference counting and delete the actual client only when the last reference calls SIOClient::disconnect().