12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef WEBSOCKETSERVER_H
- #define WEBSOCKETSERVER_H
- #include <QtCore/QObject>
- #include <QtCore/QList>
- #include <QtCore/QByteArray>
- #include <QtCore/QMap>
- #include "appmodel.h"
- #include "appview.h"
- #include "appdoc.h"
- QT_FORWARD_DECLARE_CLASS(QWebSocketServer)
- QT_FORWARD_DECLARE_CLASS(QWebSocket)
- class WebsocketServer : public QObject
- {
- Q_OBJECT
- public:
- explicit WebsocketServer(quint16 port, QObject *parent = Q_NULLPTR);
- virtual ~WebsocketServer();
- private Q_SLOTS:
- void onNewConnection();
- void processMessage(QString message);
- void socketDisconnected();
- //文本消息接收
- void textFrameReceived(const QString &frame);
- // 发送二进制消息
- void binaryMessageReceived(const QByteArray &message);
- private:
- QWebSocketServer *m_pWebSocketServer;
- QMap<int,AppView *> m_clientMap;
- QMap<int,AppDoc *> m_clientDocMap;
- // AppModel * model =NULL;
- // AppModel * model2 =NULL;
- };
- #endif // WEBSOCKETSERVER_H
|