mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 16:02:53 +00:00
Ladybird/WebView: Move WebSocket stuff to its own files
This commit is contained in:
parent
4cc82ac638
commit
e73c2c7029
Notes:
sideshowbarker
2024-07-17 04:09:56 +09:00
Author: https://github.com/awesomekling
Commit: e73c2c7029
Pull-request: https://github.com/SerenityOS/serenity/pull/16583
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/linusg
6 changed files with 188 additions and 117 deletions
34
Ladybird/WebSocketLadybird.h
Normal file
34
Ladybird/WebSocketLadybird.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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 {
|
||||
|
||||
class WebSocketLadybird
|
||||
: public Web::WebSockets::WebSocketClientSocket
|
||||
, public Weakable<WebSocketLadybird> {
|
||||
public:
|
||||
static NonnullRefPtr<WebSocketLadybird> create(NonnullRefPtr<WebSocket::WebSocket>);
|
||||
|
||||
virtual ~WebSocketLadybird() override;
|
||||
|
||||
virtual Web::WebSockets::WebSocket::ReadyState ready_state() override;
|
||||
virtual void send(ByteBuffer binary_or_text_message, bool is_text) override;
|
||||
virtual void send(StringView message) override;
|
||||
virtual void close(u16 code, String reason) override;
|
||||
|
||||
private:
|
||||
explicit WebSocketLadybird(NonnullRefPtr<WebSocket::WebSocket>);
|
||||
|
||||
NonnullRefPtr<WebSocket::WebSocket> m_websocket;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue