Created
March 20, 2025 14:44
-
-
Save esmarr58/c534d44591984ca41a421c2e531671e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void MainWindow::sendHeartbeat() { | |
| QJsonObject heartbeatMessage; | |
| heartbeatMessage["type"] = "heartbeat"; | |
| heartbeatMessage["timestamp"] = QDateTime::currentSecsSinceEpoch(); // Unix timestamp | |
| QJsonDocument doc(heartbeatMessage); | |
| QString jsonString = doc.toJson(QJsonDocument::Compact); | |
| if (m_connected) { | |
| m_webSocket->sendTextMessage(jsonString); | |
| qDebug() << "Enviando heartbeat: " << jsonString; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment