| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #ifndef WEBSOCKETCLIENT_H
- #define WEBSOCKETCLIENT_H
- #include <QObject>
- #include <QTcpSocket>
- #include <QSslError>
- #include <QList>
- #include <QString>
- #include <QUrl>
- #include <QtWebSockets/QWebSocket>
- QT_FORWARD_DECLARE_CLASS(QWebSocket)
- class WebsocketClient : public QObject
- {
- Q_OBJECT
- public:
- explicit WebsocketClient(QObject *parent = nullptr,
- QString ip="",
- quint16 port=0,
- QString termId="",
- QString termKey="");
- void reset();
- signals:
- void getData(QString data);
- void SoClosed();
- private slots:
- void onConnected();
- void onTextMessageReceived(const QString &message);
- void closeConnection();
- private:
- QTcpSocket *so;
- QString Ip;
- quint16 Port;
- QString TermId;
- QString TermKey;
- QUrl m_url;
- QWebSocket m_websocket;
- };
- #endif // WEBSOCKETCLIENT_H
|