diff --git a/wsclient.cpp b/wsclient.cpp index 744b0f0..f7bcb20 100644 --- a/wsclient.cpp +++ b/wsclient.cpp @@ -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; +} diff --git a/wsclient.h b/wsclient.h index 74043de..111c7f9 100644 --- a/wsclient.h +++ b/wsclient.h @@ -27,6 +27,7 @@ private slots: void onConnectionError(); void getTokenCallBack(APIResponse res); void onConnected(); + void onMessage(const QString &msg); private: