Add new line at the end of the message

This commit is contained in:
Simon Stürz 2018-08-22 09:08:44 +02:00
parent 6399c95d4e
commit 8ff9a00677
3 changed files with 4 additions and 4 deletions

View File

@ -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";
}

View File

@ -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()

View File

@ -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();