#ifndef WEBSOCKETSERVER_H #define WEBSOCKETSERVER_H #include #include #include #include #include "appmodel.h" #include "appview.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 m_clientMap; AppModel * model =NULL; AppModel * model2 =NULL; }; #endif // WEBSOCKETSERVER_H