mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
137d7910c0
commit
5871414e6b
|
@ -729,7 +729,7 @@ PubSub::PubSub()
|
|||
|
||||
// Add an initial client
|
||||
this->addClient();
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
void PubSub::addClient()
|
||||
{
|
||||
|
@ -818,6 +818,8 @@ void PubSub::listen(rapidjson::Document &&msg)
|
|||
return;
|
||||
}
|
||||
|
||||
this->addClient();
|
||||
|
||||
log("Added to the back of the queue");
|
||||
this->requests.emplace_back(
|
||||
std::make_unique<rapidjson::Document>(std::move(msg)));
|
||||
|
@ -936,6 +938,19 @@ void PubSub::onConnectionOpen(WebsocketHandle hdl)
|
|||
this->clients.emplace(hdl, client);
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue