/* * Copyright (c) 2021, Dex♪ * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace WebSocket { class ClientConnection final : public IPC::ClientConnection { C_OBJECT(ClientConnection); public: explicit ClientConnection(NonnullRefPtr, int client_id); ~ClientConnection() override; virtual void die() override; private: virtual Messages::WebSocketServer::ConnectResponse connect(URL const&, String const&, Vector const&, Vector const&, IPC::Dictionary const&) override; virtual Messages::WebSocketServer::ReadyStateResponse ready_state(i32) override; virtual void send(i32, bool, ByteBuffer const&) override; virtual void close(i32, u16, String const&) override; virtual Messages::WebSocketServer::SetCertificateResponse set_certificate(i32, String const&, String const&) override; void did_connect(i32); void did_receive_message(i32, Message); void did_error(i32, i32 message); void did_close(i32, u16 code, String reason, bool was_clean); void did_request_certificates(i32); i32 m_connection_ids { 0 }; HashMap> m_connections; }; }