1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:18:11 +00:00

Everywhere: Merge the WebSocket service into RequestServer

This keeps the APIs separate as they are wildly different, a future
improvement could be to somehow unify the APIs (if possible).

Closes #23080.
This commit is contained in:
Ali Mohammad Pur 2024-03-06 01:50:52 +01:00 committed by Jelle Raaijmakers
parent daf5484d6b
commit 6dfb2f9dc8
56 changed files with 231 additions and 845 deletions

View file

@ -17,7 +17,7 @@
namespace Protocol {
class WebSocketClient;
class RequestClient;
class WebSocket : public RefCounted<WebSocket> {
public:
@ -44,7 +44,7 @@ public:
Closed = 3,
};
static NonnullRefPtr<WebSocket> create_from_id(Badge<WebSocketClient>, WebSocketClient& client, i32 connection_id)
static NonnullRefPtr<WebSocket> create_from_id(Badge<RequestClient>, RequestClient& client, i32 connection_id)
{
return adopt_ref(*new WebSocket(client, connection_id));
}
@ -65,15 +65,15 @@ public:
Function<void(u16 code, ByteString reason, bool was_clean)> on_close;
Function<CertificateAndKey()> on_certificate_requested;
void did_open(Badge<WebSocketClient>);
void did_receive(Badge<WebSocketClient>, ByteBuffer, bool);
void did_error(Badge<WebSocketClient>, i32);
void did_close(Badge<WebSocketClient>, u16, ByteString, bool);
void did_request_certificates(Badge<WebSocketClient>);
void did_open(Badge<RequestClient>);
void did_receive(Badge<RequestClient>, ByteBuffer, bool);
void did_error(Badge<RequestClient>, i32);
void did_close(Badge<RequestClient>, u16, ByteString, bool);
void did_request_certificates(Badge<RequestClient>);
private:
explicit WebSocket(WebSocketClient&, i32 connection_id);
WeakPtr<WebSocketClient> m_client;
explicit WebSocket(RequestClient&, i32 connection_id);
WeakPtr<RequestClient> m_client;
int m_connection_id { -1 };
};