WebSocketView.hpp
1 #pragma once
2 
3 #include <QGraphicsScene>
4 
5 #include <verdigris>
6 
7 class WebSocketView final : public QObject
8 {
9  W_OBJECT(WebSocketView)
10 public:
11  explicit WebSocketView(QGraphicsScene* s, quint16 port, QObject* parent = Q_NULLPTR);
12  ~WebSocketView();
13 
14 public:
15  void closed() W_SIGNAL(closed);
16 
17 public:
18  void onNewConnection();
19  W_SLOT(onNewConnection);
20  void processTextMessage(QString message);
21  W_SLOT(processTextMessage);
22  void processBinaryMessage(QByteArray message);
23  W_SLOT(processBinaryMessage);
24  void socketDisconnected();
25  W_SLOT(socketDisconnected);
26 
27 private:
28  QWebSocketServer* m_pWebSocketServer;
29  QGraphicsScene* m_scene{};
30  QList<QWebSocket*> m_clients;
31  bool m_debug;
32 };
Definition: WebSocketView.hpp:8