/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/ReactCxxPlatform/react/http/platform/cxx/WebSocketClient.h
48 строк
1 KB
Christoph Purrer
Add WebSocketClient implementation for ReactCxxPlatform (#53233)
14 авг 2025, 00:43
14 авг 2025, 00:43
b75031f
Код
Авторство
О чём код?
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <react/http/IWebSocketClient.h> #include <memory> #include <string> #include <thread> namespace facebook::react { class WebSocketClient : public IWebSocketClient { public: WebSocketClient() noexcept; ~WebSocketClient() override; WebSocketClient(WebSocketClient& other) = delete; WebSocketClient& operator=(WebSocketClient& other) = delete; WebSocketClient(WebSocketClient&& other) = delete; WebSocketClient& operator=(WebSocketClient&& other) = delete; void setOnClosedCallback(OnClosedCallback&& callback) noexcept override; void setOnMessageCallback(OnMessageCallback&& callback) noexcept override; void connect( const std::string& url, OnConnectCallback&& onConnectCallback = nullptr) override; void close(const std::string& reason) override; void send(const std::string& message) override; void ping() override; private: struct Impl; // Instance data and IO thread const std::shared_ptr<Impl> impl_; std::unique_ptr<std::thread> thread_; }; } // namespace facebook::react