I'm new to Wt3(version 3.3.9 - because wole project is using it). I've met a problem and now looking for a solution.
I want to make a multithread Wt::Http::Client. From documentation I've got that using Wt::WIOService with setted thread count can do neaded, but I faced with problem of recognition which request matched to handled response.
Wt::WIOService io_service;
io_service.setThreadCount(10);
io_service.start();
//
MyClass my_http_client(io_service);
my_http_client.Work();
//
io_service.stop();
In Work() there is a loop that reading a queue of requests and sends them.
In class constructor extended from Wt::Http::Client:
done().connect(boost::bind(&MyClass::HandleHttpResponse, this, _1, _2));
Handle method:
void MyClass::HandleHttpResponse(boost::system::error_code err, const Wt::Http::Message response) {
std::unique_lock<std::mutex> lock(mutex_);
// response to inner format
// then all data goes to another class.
}
But when I'm using multithread I need exactly match request with response. I can be wrong in understaning Wt documentation. Can you help me to solve this problem?
The intended use of Wt::Http::Client
is to create a new instance for each request.