diff --git a/src/AppWrapper.h b/src/AppWrapper.h index 2a8a1db..ea373da 100644 --- a/src/AppWrapper.h +++ b/src/AppWrapper.h @@ -236,7 +236,8 @@ void uWS_App_listen(const FunctionCallbackInfo &args) { auto cb = [&args, isolate](auto *token) { /* Return a false boolean if listen failed */ Local argv[] = {token ? Local::Cast(External::New(isolate, token)) : Local::Cast(Boolean::New(isolate, false))}; - CallJS(isolate, Local::Cast(args[args.Length() - 1]), 1, argv); + /* Immediate call cannot be CallJS */ + Local::Cast(args[args.Length() - 1])->Call(isolate->GetCurrentContext(), isolate->GetCurrentContext()->Global(), 1, argv); }; /* Host is first, if present */