@tenux/cli 0.0.23 → 0.0.24
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/dist/cli.js +14 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -503,9 +503,22 @@ function connectTunnel(instanceId, localPort, accessToken, userId) {
|
|
|
503
503
|
console.log(chalk2.green("\u2713"), `[tunnel] Connected: ${tunnelUrl}`);
|
|
504
504
|
});
|
|
505
505
|
ws.on("message", (data) => {
|
|
506
|
-
|
|
506
|
+
let ab;
|
|
507
|
+
if (data instanceof ArrayBuffer) {
|
|
508
|
+
ab = data;
|
|
509
|
+
} else if (Buffer.isBuffer(data)) {
|
|
510
|
+
ab = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
511
|
+
} else {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
507
514
|
handleRelayMessage(conn, ab);
|
|
508
515
|
});
|
|
516
|
+
ws.on("unexpected-response", (_req, res) => {
|
|
517
|
+
console.log(chalk2.red("\u2717"), `[tunnel] Upgrade rejected (HTTP ${res.statusCode})`);
|
|
518
|
+
if (!conn.closed) {
|
|
519
|
+
conn.reconnectTimer = setTimeout(connect, 5e3);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
509
522
|
ws.on("close", () => {
|
|
510
523
|
if (conn.closed) return;
|
|
511
524
|
console.log(chalk2.yellow("!"), `[tunnel] Disconnected, reconnecting in 3s...`);
|