Skip to content

Commit fb8efd9

Browse files
authored
core: allow resource path to be set in connection URI for 2.x (#303)
1 parent 973eeaa commit fb8efd9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/internal/sio_client_impl.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,12 @@ namespace sio
222222
} else {
223223
ss<<uo.get_host();
224224
}
225-
ss<<":"<<uo.get_port()<<"/socket.io/?EIO=3&transport=websocket";
225+
226+
// If a resource path was included in the URI, use that, otherwise
227+
// use the default /socket.io/.
228+
const std::string path(uo.get_resource() == "/" ? "/socket.io/" : uo.get_resource());
229+
230+
ss<<":"<<uo.get_port()<<path<<"?EIO=3&transport=websocket";
226231
if(m_sid.size()>0){
227232
ss<<"&sid="<<m_sid;
228233
}

0 commit comments

Comments
 (0)