@@ -729,7 +729,7 @@ PubSub::PubSub()
|
|||||||
|
|
||||||
// Add an initial client
|
// Add an initial client
|
||||||
this->addClient();
|
this->addClient();
|
||||||
} // namespace chatterino
|
}
|
||||||
|
|
||||||
void PubSub::addClient()
|
void PubSub::addClient()
|
||||||
{
|
{
|
||||||
@@ -818,6 +818,8 @@ void PubSub::listen(rapidjson::Document &&msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->addClient();
|
||||||
|
|
||||||
log("Added to the back of the queue");
|
log("Added to the back of the queue");
|
||||||
this->requests.emplace_back(
|
this->requests.emplace_back(
|
||||||
std::make_unique<rapidjson::Document>(std::move(msg)));
|
std::make_unique<rapidjson::Document>(std::move(msg)));
|
||||||
@@ -936,6 +938,19 @@ void PubSub::onConnectionOpen(WebsocketHandle hdl)
|
|||||||
this->clients.emplace(hdl, client);
|
this->clients.emplace(hdl, client);
|
||||||
|
|
||||||
this->connected.invoke();
|
this->connected.invoke();
|
||||||
|
|
||||||
|
for (auto it = this->requests.begin(); it != this->requests.end();)
|
||||||
|
{
|
||||||
|
const auto &request = *it;
|
||||||
|
if (client->listen(*request))
|
||||||
|
{
|
||||||
|
it = this->requests.erase(it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PubSub::onConnectionClose(WebsocketHandle hdl)
|
void PubSub::onConnectionClose(WebsocketHandle hdl)
|
||||||
|
|||||||
Reference in New Issue
Block a user