diff --git a/src/AppWrapper.h b/src/AppWrapper.h index f8e03ae..76860c8 100644 --- a/src/AppWrapper.h +++ b/src/AppWrapper.h @@ -58,13 +58,17 @@ void uWS_App_ws(const FunctionCallbackInfo &args) { Local wsObject = WebSocketWrapper::getWsInstance(); wsObject->SetAlignedPointerInInternalField(0, ws); + /* Create the HttpRequest wrapper */ + Local reqObject = HttpRequestWrapper::getReqInstance(); + reqObject->SetAlignedPointerInInternalField(0, req); + /* Attach a new V8 object with pointer to us, to us */ PerSocketData *perSocketData = (PerSocketData *) ws->getUserData(); perSocketData->socketPf = new Persistent; perSocketData->socketPf->Reset(isolate, wsObject); - Local argv[] = {wsObject}; - Local::New(isolate, *openPf)->Call(isolate->GetCurrentContext()->Global(), 1, argv); + Local argv[] = {wsObject, reqObject}; + Local::New(isolate, *openPf)->Call(isolate->GetCurrentContext()->Global(), 2, argv); }; behavior.message = [messagePf](auto *ws, std::string_view message, uWS::OpCode opCode) {