Search code examples
javascriptnode.jspuppeteerwebautomation

What are the advantages and disadvantages of connecting Puppeteer over pipe instead of a websocket


Puppeteer supports connection to the browser either using a websocket (default) or using a pipe.

puppeteer.launch({ pipe: true });

What are the advantages of either of those approaches? Why would I choose one over the other? What are their disadvantages?


Solution

  • pipes should be your default if you run everything (puppeteer and chromium) in the same server. They are even considering making that the default. The pro is that's a private connection between puppeteer and chromium. You are not opening a WebSocket to "the world". The con is that you can't re-use the chromium instance with another puppeteer process.

    I think you can infer the pros and cons of WebSockets from the previous paragraphs. You would use WebSocket if you need to share a chromium instance across many puppeteer processes or from a different computer.

    There are no big differences in performance though.