19#ifndef CPPREALM_NETWORKING_WEBSOCKET_HPP
20#define CPPREALM_NETWORKING_WEBSOCKET_HPP
22#include <cpprealm/internal/bridge/status.hpp>
23#include <cpprealm/internal/bridge/realm.hpp>
25#ifndef REALMCXX_VERSION_MAJOR
26#include <cpprealm/version_numbers.hpp>
34 class SyncSocketProvider;
35 struct WebSocketInterface;
36 struct WebSocketObserver;
48 std::vector<std::string>
协议;
53 枚举 class websocket_err_codes {
56 protocol_error = 1002,
57 unsupported_data = 1003 ,
58 websocket_reserved = 1004 ,
59 no_status_received = 1005 ,
61 invalid_payload_data = 1007 ,
62 policy_violation = 1008 ,
63 message_too_big = 1009 ,
64 invalid_extension = 1010 ,
65 invalid_server_error = 1011,
66 TLS_handshake_failed = 1015 ,
70 move_permanently = 4003 ,
71 client_too_old = 4004 ,
72 client_too_new = 4005 ,
73 protocol_mismatch = 4006,
75 resolve_failed = 4400 ,
76 connection_failed = 4401 ,
84 struct websocket_interface;
85 struct websocket_observer;
137 运用 sync_timer = std::unique_ptr<sync_socket_provider::timer>;
149 virtual std::unique_ptr<websocket_interface>
connect (std::unique_ptr<websocket_observer> Observer,
203 using FunctionHandler = std::function<void(
status )>;
263 std::string_view message) = 0;
276std::Optional<::realm::internal::bridge::realm::sync_config::proxy_config>
proxy_config ;
278 using SSLVerifyCallback = bool(
const std::string& server_address,
279 internal::bridge:: 域::sync_config::proxy_config::port_type server_port,
280 const char* pem_data,
size_t pem_size,
int preverify_ok,
int depth);
308std::unique_ptr<::realm::sync::SyncSocketProvider> m_provider;
virtual std::unique_ptr< websocket_interface > connect(std::unique_ptr< websocket_observer > Observer, websocket_endpoint &&endpoint)= 0
虚拟 ~sync_socket_provider()=默认
std::unique_ptr< sync_socket_provider::timer > sync_timer
其他类的 typedef。
定义: websocket.hpp: 137
std::function< void(status)> FunctionHandler
函数处理程序 typedef.
定义: websocket.hpp: 116
virtual sync_timer create_timer(std::chrono::milliseconds Delay, FunctionHandler &&handler)= 0
virtual void 帖子(FunctionHandler &&handler)= 0
bool client_validate_ssl
定义: websocket.hpp: 284
std::Optional<::realm::internal::bridge::realm::sync_config::proxy_config > proxy_config
定义: websocket.hpp: 276
std::function< SSLVerifyCallback > ssl_verify_callback
定义: websocket.hpp: 294
std::optional< std::map< std::string, std::string > > custom_http_headers
定义: websocket.hpp: 272
std::option< std::string > ssl_trust_certificate_path
定义: websocket.hpp: 288
内置 websocket提供商。
定义: websocket.hpp: 267
sync_timer create_timer(std::chrono::milliseconds延迟,FunctionHandler &&) 覆盖
定义: websocket.cpp: 84
void 帖子(FunctionHandler &&) 覆盖
定义: websocket.cpp: 78
std::unique_ptr < websocket_interface > connect(std::unique_ptr < websocket_observer >, websocket_endpoint &&) 覆盖
定义: websocket.cpp: 71
虚拟 ~timer()=默认
取消计时器并销毁计时器实例。
std::vector< std::string > 协议
一个或多个 Websocket 协议的数组。
定义: websocket.hpp: 48
std::string URL
要连接的 websocket URL。
定义: websocket.hpp: 50
虚拟 ~websocket_interface()=默认
virtual void async_write_binary(std::string_view data, FunctionHandler &&handler)= 0
virtual void websocket_error_handler()= 0
virtual void websocket_connected_handler(const std::string &protocol)= 0
virtual bool websocket_binary_message_received(std::string_view data)= 0
virtual bool websocket_close_handler(bool was_clean, websocket_err_codes error_code, std::string_view message)= 0