mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:57:34 +00:00
LibWebSocket: Make WebSocketImpl an abstract class
The LibCore sockets implementation becomes WebSocketImplSerenity. This will allow us to create a custom WebSocketImpl subclass for Qt to use in Ladybird.
This commit is contained in:
parent
cc78a74c51
commit
be5f6aa46e
6 changed files with 144 additions and 81 deletions
33
Userland/Libraries/LibWebSocket/Impl/WebSocketImplSerenity.h
Normal file
33
Userland/Libraries/LibWebSocket/Impl/WebSocketImplSerenity.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Dex♪ <dexes.ttp@gmail.com>
|
||||
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWebSocket/Impl/WebSocketImpl.h>
|
||||
|
||||
namespace WebSocket {
|
||||
|
||||
class WebSocketImplSerenity final : public WebSocketImpl {
|
||||
public:
|
||||
explicit WebSocketImplSerenity();
|
||||
virtual ~WebSocketImplSerenity() override;
|
||||
|
||||
virtual void connect(ConnectionInfo const&) override;
|
||||
virtual bool can_read_line() override;
|
||||
virtual ErrorOr<String> read_line(size_t) override;
|
||||
virtual bool can_read() override;
|
||||
virtual ErrorOr<ByteBuffer> read(int max_size) override;
|
||||
virtual bool send(ReadonlyBytes) override;
|
||||
virtual bool eof() override;
|
||||
virtual void discard_connection() override;
|
||||
|
||||
private:
|
||||
OwnPtr<Core::Stream::BufferedSocketBase> m_socket;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue