File indexing completed on 2024-12-01 10:39:48
0001 /* 0002 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "abstractwebsocket.h" 0010 0011 class QWebSocket; 0012 class RuqolaLogger; 0013 class RuqolaWebSocket : public AbstractWebSocket 0014 { 0015 Q_OBJECT 0016 public: 0017 explicit RuqolaWebSocket(RuqolaLogger *logger, QObject *parent = nullptr); 0018 ~RuqolaWebSocket() override; 0019 0020 void openUrl(const QUrl &url) override; 0021 qint64 sendTextMessage(const QString &message) override; 0022 [[nodiscard]] bool isValid() const override; 0023 void flush() override; 0024 void close() override; 0025 [[nodiscard]] QAbstractSocket::SocketError error() const override; 0026 [[nodiscard]] QString errorString() const override; 0027 [[nodiscard]] QUrl requestUrl() const override; 0028 [[nodiscard]] QWebSocketProtocol::CloseCode closeCode() const override; 0029 [[nodiscard]] QString closeReason() const override; 0030 qint64 sendBinaryMessage(const QByteArray &data) override; 0031 void ignoreSslErrors() override; 0032 0033 private: 0034 void slotTextMessageReceived(const QString &msg); 0035 void slotError(QAbstractSocket::SocketError error); 0036 0037 private: 0038 RuqolaLogger *const mLogger; 0039 QWebSocket *const mWebSocket; 0040 };