I have this structure of code (including sockets and puppeteer):
client.on('find', (url) => {
console.log(url); // url == "google.ru"
(async function(){
await page.goto(url); // url == "google.ru"
await page.evaluate(async () => {
var response = await fetch(url); // url == undefined
var json = await response.json();
return json;
});
})();
});
I have tried some variations (closures etc.) but can't make it work. How to correctly pass url variable ?