mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 20:19:14 +00:00
Add the option to use "browserWSEndpoint" (#727)
* Update Client.js * Update package.json * Update package.json * 🚨🔥 Fixed ESLint and removed old code. * Update README.md * Update README.md * Update Client.js * chore(deps): bump sharp from 0.26.3 to 0.28.3 Bumps [sharp](https://github.com/lovell/sharp) from 0.26.3 to 0.28.3. - [Release notes](https://github.com/lovell/sharp/releases) - [Changelog](https://github.com/lovell/sharp/blob/master/docs/changelog.md) - [Commits](https://github.com/lovell/sharp/compare/v0.26.3...v0.28.3) --- updated-dependencies: - dependency-name: sharp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update package.json * Update README.md * Update example.js * Update README.md Co-authored-by: Rajeh Taher <52720753+PurpShell@users.noreply.github.com> Co-authored-by: Rajeh Taher <rajeh@reforward.tk> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aliyss Snow <33941859+Aliyss@users.noreply.github.com>
This commit is contained in:
@@ -65,8 +65,16 @@ class Client extends EventEmitter {
|
||||
* Sets up events and requirements, kicks off authentication request
|
||||
*/
|
||||
async initialize() {
|
||||
const browser = await puppeteer.launch(this.options.puppeteer);
|
||||
const page = (await browser.pages())[0];
|
||||
let [browser, page] = [null, null];
|
||||
|
||||
if(this.options.puppeteer && this.options.puppeteer.browserWSEndpoint) {
|
||||
browser = await puppeteer.connect(this.options.puppeteer);
|
||||
page = await browser.newPage();
|
||||
} else {
|
||||
browser = await puppeteer.launch(this.options.puppeteer);
|
||||
page = (await browser.pages())[0];
|
||||
}
|
||||
|
||||
page.setUserAgent(this.options.userAgent);
|
||||
|
||||
this.pupBrowser = browser;
|
||||
|
||||
Reference in New Issue
Block a user