/* * Copyright (c) 2021, Dex♪ * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace WebSocket { class AbstractWebSocketImpl : public Core::Object { C_OBJECT_ABSTRACT(AbstractWebSocketImpl); public: virtual ~AbstractWebSocketImpl() override; explicit AbstractWebSocketImpl(Core::Object* parent = nullptr); virtual void connect(ConnectionInfo const&) = 0; virtual bool can_read_line() = 0; virtual String read_line(size_t size) = 0; virtual bool can_read() = 0; virtual ByteBuffer read(int max_size) = 0; virtual bool send(ReadonlyBytes) = 0; virtual bool eof() = 0; virtual void discard_connection() = 0; Function on_connected; Function on_connection_error; Function on_ready_to_read; }; }