node-datachannel
Version:
WebRTC For Node.js and Electron. libdatachannel node bindings.
46 lines (33 loc) • 1.11 kB
Plain Text
class WebSocketServerWrapper : public Napi::ObjectWrap<WebSocketServerWrapper>
{
public:
static Napi::Object Init(Napi::Env env, Napi::Object exports);
WebSocketServerWrapper(const Napi::CallbackInfo &info);
~WebSocketServerWrapper();
// Functions
void stop(const Napi::CallbackInfo &info);
Napi::Value port(const Napi::CallbackInfo &info);
// Callbacks
void onClient(const Napi::CallbackInfo &info);
// Close all existing WebSocketServers
static void StopAll();
private:
static Napi::FunctionReference constructor;
static std::unordered_set<WebSocketServerWrapper *> instances;
void doStop();
std::unique_ptr<rtc::WebSocketServer> mWebSocketServerPtr = nullptr;
// Callback Ptrs
std::unique_ptr<ThreadSafeCallback> mOnClientCallback = nullptr;
};