// WebSocketChannel.h #pragma once #include "baseChannel.h" #include class DIAGRAM_DESIGNER_PUBLIC WebSocketChannel : public BaseChannel { Q_OBJECT public: struct WebSocketConfig { int heartbeatInterval = 30000; }; WebSocketChannel(const ChannelConfig& config, QObject* parent = nullptr); bool connect() override; bool disconnect() override; bool isConnected() const override; bool send(const QByteArray& data) override; bool sendText(const QString& text); void setWebSocketConfig(const WebSocketConfig& config); signals: void textMessageReceived(const QString& message); private slots: void onConnected(); void onDisconnected(); void onTextMessageReceived(const QString& message); void onBinaryMessageReceived(const QByteArray& message); private: QWebSocket* m_webSocket = nullptr; WebSocketConfig m_wsConfig; };