refactor: move Connection to use ConnectionTransport (#3217)

Currently connection assumes that transport is a websocket
and tries to handle websocket-related errors.

This patch:
- moves ConnectionTransport interface to use callbacks instead
  of events. This way it could be used in browser context as well.
- introduces WebSocketTransport that implements ConnectionTransport
  interface for ws.

This is a preparation step for 2 things:
- exposing `transport` option in the `puppeteer.connect` method
- better support for `browserify`

References #2119
This commit is contained in:
Andrey Lushnikov
2018-09-07 21:36:16 +01:00
committed by GitHub
parent c967aebc84
commit 1b2c8113ba
6 changed files with 93 additions and 42 deletions

View File

@@ -31,9 +31,10 @@ const EXCLUDE_CLASSES = new Set([
'Multimap',
'NavigatorWatcher',
'NetworkManager',
'Pipe',
'PipeTransport',
'TaskQueue',
'WaitTask',
'WebSocketTransport',
]);
const EXCLUDE_PROPERTIES = new Set([