Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 896
Ondra Urban Avatar asked Feb 28 '19 09:02

Ondra Urban


1 Answers

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.

like image 171
hardkoded Avatar answered Nov 11 '22 14:11

hardkoded