cdp-tunnel 2.7.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,12 +27,13 @@ importScripts('features/automation-badge.js');
|
|
|
27
27
|
keepAliveInterval = setInterval(function() {
|
|
28
28
|
var ws = State.getWs();
|
|
29
29
|
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
30
|
-
Logger.info('[KeepAlive] Sending heartbeat');
|
|
31
30
|
WebSocketManager.send({ type: 'keepalive', timestamp: Date.now() });
|
|
32
31
|
}
|
|
33
32
|
}, 20000);
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
chrome.alarms.clear('sw-keepalive', function() {
|
|
35
|
+
chrome.alarms.create('sw-keepalive', { periodInMinutes: 0.4 });
|
|
36
|
+
});
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
function stopKeepAlive() {
|
|
@@ -362,5 +363,16 @@ importScripts('features/automation-badge.js');
|
|
|
362
363
|
return true;
|
|
363
364
|
});
|
|
364
365
|
|
|
366
|
+
chrome.alarms.onAlarm.addListener(function(alarm) {
|
|
367
|
+
if (alarm.name === 'sw-keepalive') {
|
|
368
|
+
var ws = State.getWs();
|
|
369
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
370
|
+
WebSocketManager.send({ type: 'keepalive', timestamp: Date.now() });
|
|
371
|
+
} else {
|
|
372
|
+
WebSocketManager.connect();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
365
377
|
init();
|
|
366
378
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "CDP Bridge",
|
|
4
|
-
"version": "2.7.
|
|
4
|
+
"version": "2.7.1",
|
|
5
5
|
"description": "Chrome DevTools Protocol Bridge for Playwright/Puppeteer automation",
|
|
6
6
|
"permissions": [
|
|
7
7
|
"debugger",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"scripting",
|
|
11
11
|
"storage",
|
|
12
12
|
"downloads",
|
|
13
|
-
"tabGroups"
|
|
13
|
+
"tabGroups",
|
|
14
|
+
"alarms"
|
|
14
15
|
],
|
|
15
16
|
"host_permissions": [
|
|
16
17
|
"<all_urls>"
|
package/package.json
CHANGED
package/server/modules/config.js
CHANGED
|
@@ -9,7 +9,8 @@ const CONFIG = {
|
|
|
9
9
|
CLIENT_IDLE_TIMEOUT: 300000,
|
|
10
10
|
LOG_LEVEL: process.env.LOG_LEVEL || 'info',
|
|
11
11
|
AUTO_RESTART: process.env.AUTO_RESTART === 'true',
|
|
12
|
-
CHROME_RESTART_COOLDOWN: 30000
|
|
12
|
+
CHROME_RESTART_COOLDOWN: 30000,
|
|
13
|
+
PLUGIN_MAX_MISSED_PINGS: 3
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const LOG_LEVELS = {
|
package/server/proxy-server.js
CHANGED
|
@@ -1634,12 +1634,20 @@ const heartbeatInterval = setInterval(() => {
|
|
|
1634
1634
|
|
|
1635
1635
|
pluginConnections.forEach((ws) => {
|
|
1636
1636
|
if (!ws.isAlive) {
|
|
1637
|
-
|
|
1638
|
-
|
|
1637
|
+
ws.missedPings = (ws.missedPings || 0) + 1;
|
|
1638
|
+
if (ws.missedPings >= CONFIG.PLUGIN_MAX_MISSED_PINGS) {
|
|
1639
|
+
if (shouldLog('warn')) {
|
|
1640
|
+
console.log(`[${now}] Plugin ${ws.id} missed ${ws.missedPings} pings, terminating...`);
|
|
1641
|
+
}
|
|
1642
|
+
logConnectionEvent('HEARTBEAT_TIMEOUT', { type: 'plugin', id: ws.id, missedPings: ws.missedPings });
|
|
1643
|
+
cleanupPlugin(ws, ws.id, 'heartbeat_timeout');
|
|
1644
|
+
return ws.terminate();
|
|
1639
1645
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1646
|
+
if (shouldLog('info')) {
|
|
1647
|
+
console.log(`[${now}] Plugin ${ws.id} missed ping ${ws.missedPings}/${CONFIG.PLUGIN_MAX_MISSED_PINGS}`);
|
|
1648
|
+
}
|
|
1649
|
+
} else {
|
|
1650
|
+
ws.missedPings = 0;
|
|
1643
1651
|
}
|
|
1644
1652
|
ws.isAlive = false;
|
|
1645
1653
|
ws.ping();
|