blob: 2bb8a3f88d23e8fa7aa6b36ad49b7e31e25a12c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/*
* Copyright (c) 2021, Dex♪ <dexes.ttp@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/Span.h>
#include <AK/String.h>
#include <LibCore/Object.h>
#include <LibWebSocket/ConnectionInfo.h>
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<void()> on_connected;
Function<void()> on_connection_error;
Function<void()> on_ready_to_read;
};
}
|