From 8ff9a0067784975981d43e2883babb0ae76693c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 22 Aug 2018 09:08:44 +0200 Subject: [PATCH] Add new line at the end of the message --- libnymea-remoteproxy/websocketserver.cpp | 2 +- libnymea-remoteproxyclient/websocketconnection.cpp | 2 +- tests/test-offline/nymea-remoteproxy-tests-offline.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libnymea-remoteproxy/websocketserver.cpp b/libnymea-remoteproxy/websocketserver.cpp index a8ded67..e0f94a3 100644 --- a/libnymea-remoteproxy/websocketserver.cpp +++ b/libnymea-remoteproxy/websocketserver.cpp @@ -67,7 +67,7 @@ void WebSocketServer::sendData(const QUuid &clientId, const QByteArray &data) client = m_clientList.value(clientId); if (client) { qCDebug(dcWebSocketServerTraffic()) << "--> Sending data to client:" << data; - client->sendTextMessage(data); + client->sendTextMessage(data + '\n'); } else { qCWarning(dcWebSocketServer()) << "Client" << clientId << "unknown to this transport"; } diff --git a/libnymea-remoteproxyclient/websocketconnection.cpp b/libnymea-remoteproxyclient/websocketconnection.cpp index f984a9c..b0f2455 100644 --- a/libnymea-remoteproxyclient/websocketconnection.cpp +++ b/libnymea-remoteproxyclient/websocketconnection.cpp @@ -50,7 +50,7 @@ QUrl WebSocketConnection::serverUrl() const void WebSocketConnection::sendData(const QByteArray &data) { - m_webSocket->sendTextMessage(QString::fromUtf8(data)); + m_webSocket->sendTextMessage(QString::fromUtf8(data + '\n')); } void WebSocketConnection::ignoreSslErrors() diff --git a/tests/test-offline/nymea-remoteproxy-tests-offline.cpp b/tests/test-offline/nymea-remoteproxy-tests-offline.cpp index bb83a06..725fc93 100644 --- a/tests/test-offline/nymea-remoteproxy-tests-offline.cpp +++ b/tests/test-offline/nymea-remoteproxy-tests-offline.cpp @@ -459,12 +459,12 @@ void RemoteProxyOfflineTests::remoteConnection() connectionOne->sendData(dataOne); remoteConnectionDataTwo.wait(500); QVERIFY(remoteConnectionDataTwo.count() == 1); - QCOMPARE(remoteConnectionDataTwo.at(0).at(0).toByteArray(), dataOne); + QCOMPARE(remoteConnectionDataTwo.at(0).at(0).toByteArray().trimmed(), dataOne); connectionTwo->sendData(dataTwo); remoteConnectionDataOne.wait(500); QVERIFY(remoteConnectionDataOne.count() == 1); - QCOMPARE(remoteConnectionDataOne.at(0).at(0).toByteArray(), dataTwo); + QCOMPARE(remoteConnectionDataOne.at(0).at(0).toByteArray().trimmed(), dataTwo); connectionOne->deleteLater(); connectionTwo->deleteLater();