api-response-manager 2.6.1 → 2.6.3
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.
- package/README.md +1 -1
- package/commands/serve.js +12 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/commands/serve.js
CHANGED
|
@@ -454,7 +454,10 @@ async function connectFileTunnel(tunnelId, subdomain, localPort) {
|
|
|
454
454
|
function connect() {
|
|
455
455
|
if (isShuttingDown) return;
|
|
456
456
|
|
|
457
|
-
const ws = new WebSocket(tunnelServerUrl
|
|
457
|
+
const ws = new WebSocket(tunnelServerUrl, {
|
|
458
|
+
// Keep connection alive with WebSocket-level ping/pong
|
|
459
|
+
perMessageDeflate: false
|
|
460
|
+
});
|
|
458
461
|
|
|
459
462
|
ws.on('open', () => {
|
|
460
463
|
reconnectAttempts = 0; // Reset on successful connection
|
|
@@ -476,12 +479,17 @@ async function connectFileTunnel(tunnelId, subdomain, localPort) {
|
|
|
476
479
|
clearInterval(heartbeatInterval);
|
|
477
480
|
}
|
|
478
481
|
|
|
479
|
-
// Heartbeat every
|
|
482
|
+
// Heartbeat every 10 seconds to keep connection alive during large transfers
|
|
480
483
|
heartbeatInterval = setInterval(() => {
|
|
481
484
|
if (ws.readyState === WebSocket.OPEN) {
|
|
482
485
|
ws.send(JSON.stringify({ type: 'heartbeat', tunnelId, subdomain }));
|
|
483
486
|
}
|
|
484
|
-
},
|
|
487
|
+
}, 10000);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
// Respond to WebSocket-level ping from server
|
|
491
|
+
ws.on('ping', () => {
|
|
492
|
+
ws.pong();
|
|
485
493
|
});
|
|
486
494
|
|
|
487
495
|
ws.on('message', async (data) => {
|
|
@@ -524,7 +532,7 @@ async function connectFileTunnel(tunnelId, subdomain, localPort) {
|
|
|
524
532
|
validateStatus: () => true,
|
|
525
533
|
responseType: 'arraybuffer',
|
|
526
534
|
maxRedirects: 0,
|
|
527
|
-
timeout:
|
|
535
|
+
timeout: 0 // No timeout for large file transfers
|
|
528
536
|
});
|
|
529
537
|
|
|
530
538
|
const cleanHeaders = { ...response.headers };
|