socket.io-client-cpp
socket.io-client-cpp copied to clipboard
cpp client connect with custom path
on the API
const socket = io('http://localhost', {
path: '/myownpath'
});
// server-side
const io = require('socket.io')({
path: '/myownpath'
});
and sio_client.h:
// Client Functions - such as send, etc.
void connect(const std::string& uri);
void connect(const std::string& uri, const std::map<std::string,std::string>& query);
void connect(const std::string& uri, const std::map<std::string,std::string>& query,
const std::map<std::string,std::string>& http_extra_headers);
what should i do with cpp client?
@darrachequesne Hi, I'm using this C++ client to connect socket io server as well, and having the same requirement now, any update or plan for this enhancement? Thanks!
Hello As @wzzaz and @echo-qin , i'd like to have some informations.
I've found that in sio_client_impl.cpp ...
const std::string host(uo.get_host());
// As per RFC2732, literal IPv6 address should be enclosed in "[" and "]".
if(host.find(':')!=std::string::npos){
ss<<"["<<uo.get_host()<<"]";
} else {
ss<<uo.get_host();
}
// 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());
Thanks