Ready to process WebSocket messages

This commit is contained in:
Pierre HUBERT 2020-06-13 11:45:08 +02:00
parent 9394e6b153
commit ff955398b9
2 changed files with 7 additions and 0 deletions

View File

@ -8,6 +8,7 @@ WsClient::WsClient(QObject *parent) : QObject(parent)
{
connect(&mWebSocket, &QWebSocket::connected, this, &WsClient::onConnected);
connect(&mWebSocket, &QWebSocket::disconnected, this, &WsClient::onConnectionError);
connect(&mWebSocket, &QWebSocket::textMessageReceived, this, &WsClient::onMessage);
startConnect();
}
@ -45,3 +46,8 @@ void WsClient::onConnected()
{
qDebug() << "Connected to WebSocket";
}
void WsClient::onMessage(const QString &msg)
{
qDebug() << "WS message: " << msg;
}

View File

@ -27,6 +27,7 @@ private slots:
void onConnectionError();
void getTokenCallBack(APIResponse res);
void onConnected();
void onMessage(const QString &msg);
private: