-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatClient.h
More file actions
44 lines (34 loc) · 937 Bytes
/
ChatClient.h
File metadata and controls
44 lines (34 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Created by asd on 28-Oct-23.
//
#ifndef ASIO_CLIENT_CCLIENT_H
#define ASIO_CLIENT_CCLIENT_H
#include <QSslSocket>
#include <QSslConfiguration>
#include <QObject>
#include <QtWebSockets/QtWebSockets>
class ChatClient : public QObject {
Q_OBJECT
public:
ChatClient();
void Connect(QNetworkRequest req);
void Write(const QString& msg);
private:
void ConfigureSocketForSsl();
QWebSocket ws;
bool pongReceived;
QTimer pingTimer;
int pingRespondTimeMsecs = 5000;
signals:
void MessageReceived(const QString& msg);
void ConnectionLost();
private slots:
void SslErrors(const QList<QSslError> &errors);
void OnMessageReceived(const QString& message);
void Connected();
void Disconnected();
void ErrorOccurred(QAbstractSocket::SocketError error);
void PongReceived(quint64 elapsedTime, const QByteArray& payload);
void DoPing();
};
#endif //ASIO_CLIENT_CCLIENT_H