Static Webview - RTC - UDP - TCP - WSS

This commit is contained in:
2026-10-03 01:22:41 -07:00
parent 058104d93f
commit 75224df058
19 changed files with 1994 additions and 284 deletions

View File

@ -11,6 +11,7 @@
#include <vector>
#include <atomic>
#include <thread>
#include <future>
#include <v8.h>
#include <memory>
@ -68,6 +69,7 @@ namespace WebSocketWrapper {
void processEvents();
ReadyState getReadyState() const { return ready_state_; }
bool hasPendingEvents() const { return !event_queue_.empty(); }
const std::string& getUrl() const { return url_; }
const std::string& getProtocol() const { return protocol_; }
int getBufferedAmount() const { return buffered_amount_; }
@ -83,7 +85,7 @@ namespace WebSocketWrapper {
v8::Global<v8::Context>* global_context_;
std::string url_;
std::string protocol_;
ReadyState ready_state_;
std::atomic<ReadyState> ready_state_;
bool is_ssl_;
int buffered_amount_;
@ -94,9 +96,9 @@ namespace WebSocketWrapper {
v8::Global<v8::Function> on_close_;
LockFreeQueue<WebSocketEvent> event_queue_;
void* ws_;
void* ssl_ws_;
std::future<void> connect_future_;
int ws_;
#ifdef WITH_SSL
#ifdef _WIN32
@ -131,8 +133,6 @@ namespace WebSocketWrapper {
std::string base64Encode(const std::string& data);
// called from worker thread
void handleOpen();
void handleMessage(const std::string& message);
void handleError(const std::string& error);
void handleClose(int code, const std::string& reason);