Actually do pass req to ws open

This commit is contained in:
Alex Hultman 2019-01-17 07:33:31 +01:00
parent 14ea861205
commit 3558bf30d9
1 changed files with 6 additions and 2 deletions

View File

@ -58,13 +58,17 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
Local<Object> wsObject = WebSocketWrapper::getWsInstance<APP>();
wsObject->SetAlignedPointerInInternalField(0, ws);
/* Create the HttpRequest wrapper */
Local<Object> 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<Object>;
perSocketData->socketPf->Reset(isolate, wsObject);
Local<Value> argv[] = {wsObject};
Local<Function>::New(isolate, *openPf)->Call(isolate->GetCurrentContext()->Global(), 1, argv);
Local<Value> argv[] = {wsObject, reqObject};
Local<Function>::New(isolate, *openPf)->Call(isolate->GetCurrentContext()->Global(), 2, argv);
};
behavior.message = [messagePf](auto *ws, std::string_view message, uWS::OpCode opCode) {