-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebsockets.h
40 lines (33 loc) · 1012 Bytes
/
websockets.h
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
#ifndef WEBSOCKETS_H
#define WEBSOCKETS_H
#include <QWidget>
#include <QBuffer>
#include <QTcpServer>
#include <QUrl>
#include <QUrlQuery>
#include "qwebsockets/websocketserver.h"
#include "qwebsockets/websocket.h"
#include "global.h"
class WebSockets : public QObject, public SenderInterface {
Q_OBJECT
public:
explicit WebSockets(QWidget *_uiFeedback, QObject *parent = 0);
~WebSockets();
private:
WebSocketServer webSocketServer;
QList<WebSocket*> webSocketClients;
private slots:
void webSocketsNewConnection();
void webSocketsProcessMessage(const QString &message);
void webSocketsProcessBinaryMessage(const QByteArray &message);
void webSocketsSocketDisconnected();
void webSocketsUpdateConnectedClients();
public:
void close();
public:
QString send(const QByteArray &message, const QString &ip = "", quint16 port = 0, void *sender = 0);
void setPort(quint16 port);
signals:
void outgoingMessage(const QString &log);
};
#endif // WEBSOCKETS_H