Search code examples
puppeteerlong-pollingplaywright

Playwright get long polling response body


How can you get the response body "stream" of a long polling response in Microsoft Playwright or Puppeteer using page.on('response',myfunction)?
The content type of the response is 'text/event-stream'.
The code stops at await response.body(), is there some solution in Python?
I would be grateful for solutions in other languages as well.


Solution

  • I asked this on the Playwright Github: This is the anwser of someone responsible for the project (I hope it's alright if I post this here):
    "For now subscribing to EventSource.onmessage via javascript is your best bet if you can't wait until the request is finished."
    He changed my question into a feature request.