2022-09-19 12:16:42 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
|
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/WebSockets/WebSocket.h>
|
|
|
|
#include <LibWebSocket/WebSocket.h>
|
|
|
|
|
|
|
|
namespace Ladybird {
|
|
|
|
|
2023-08-02 21:01:17 +03:00
|
|
|
class WebSocketQt
|
2022-09-19 12:16:42 +03:00
|
|
|
: public Web::WebSockets::WebSocketClientSocket
|
2023-08-02 21:01:17 +03:00
|
|
|
, public Weakable<WebSocketQt> {
|
2022-09-19 12:16:42 +03:00
|
|
|
public:
|
2023-08-02 21:01:17 +03:00
|
|
|
static NonnullRefPtr<WebSocketQt> create(NonnullRefPtr<WebSocket::WebSocket>);
|
2022-09-19 12:16:42 +03:00
|
|
|
|
2023-08-02 21:01:17 +03:00
|
|
|
virtual ~WebSocketQt() override;
|
2022-09-19 12:16:42 +03:00
|
|
|
|
|
|
|
virtual Web::WebSockets::WebSocket::ReadyState ready_state() override;
|
2022-12-31 13:37:10 +03:00
|
|
|
virtual DeprecatedString subprotocol_in_use() override;
|
2022-09-19 12:16:42 +03:00
|
|
|
virtual void send(ByteBuffer binary_or_text_message, bool is_text) override;
|
|
|
|
virtual void send(StringView message) override;
|
2022-12-04 21:43:54 +03:00
|
|
|
virtual void close(u16 code, DeprecatedString reason) override;
|
2022-09-19 12:16:42 +03:00
|
|
|
|
|
|
|
private:
|
2023-08-02 21:01:17 +03:00
|
|
|
explicit WebSocketQt(NonnullRefPtr<WebSocket::WebSocket>);
|
2022-09-19 12:16:42 +03:00
|
|
|
|
|
|
|
NonnullRefPtr<WebSocket::WebSocket> m_websocket;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|