core: allow resource path to be set in connection URI for 2.x (#303)

This commit is contained in:
焼き猫 2022-03-29 16:07:14 +08:00 committed by GitHub
parent 973eeaa6e3
commit fb8efd9503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,7 +222,12 @@ namespace sio
} else {
ss<<uo.get_host();
}
ss<<":"<<uo.get_port()<<"/socket.io/?EIO=3&transport=websocket";
// If a resource path was included in the URI, use that, otherwise
// use the default /socket.io/.
const std::string path(uo.get_resource() == "/" ? "/socket.io/" : uo.get_resource());
ss<<":"<<uo.get_port()<<path<<"?EIO=3&transport=websocket";
if(m_sid.size()>0){
ss<<"&sid="<<m_sid;
}