break;
}
- m_OutgoingMessagesQueue.emplace_back(new Dictionary({
+ SendMessageInternal(new Dictionary({
{ "jsonrpc", "2.0" },
{ "method", "event::Heartbeat" },
{ "params", new Dictionary({
{ "timeout", 120 }
}) }
}));
-
- m_OutgoingMessagesQueued.Set();
}
}
void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
{
- m_IoStrand.post([this, message]() {
- m_OutgoingMessagesQueue.emplace_back(message);
- m_OutgoingMessagesQueued.Set();
- });
+ m_IoStrand.post([this, message]() { SendMessageInternal(message); });
+}
+
+void JsonRpcConnection::SendMessageInternal(const Dictionary::Ptr& message)
+{
+ m_OutgoingMessagesQueue.emplace_back(message);
+ m_OutgoingMessagesQueued.Set();
}
void JsonRpcConnection::Disconnect()
resultMessage->Set("jsonrpc", "2.0");
resultMessage->Set("id", message->Get("id"));
- m_OutgoingMessagesQueue.emplace_back(resultMessage);
- m_OutgoingMessagesQueued.Set();
+ SendMessageInternal(resultMessage);
}
}