@ayankhandelwal07/local-loop 1.1.8 ā 1.1.9
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/index.js +11 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,9 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const PRODUCTION_SERVER = 'https://localloop-server.onrender.com';
|
|
12
12
|
const PRODUCTION_DASHBOARD_URL = 'https://local-loop-gamma.vercel.app';
|
|
13
|
+
// const PRODUCTION_SERVER = 'http://localhost:3000';
|
|
14
|
+
// const PRODUCTION_DASHBOARD_URL = 'http://localhost:5173'
|
|
15
|
+
let heartbeatInterval;
|
|
13
16
|
const program = new commander_1.Command();
|
|
14
17
|
program
|
|
15
18
|
.version('1.0.1')
|
|
@@ -36,6 +39,12 @@ socket.on('connect', () => {
|
|
|
36
39
|
});
|
|
37
40
|
socket.on('registered', (data) => {
|
|
38
41
|
console.log(chalk_1.default.green(`\nš Tunnel Live at: ${chalk_1.default.bold(data.url)}`));
|
|
42
|
+
const fullId = data.url.split('/hook/')[1];
|
|
43
|
+
if (heartbeatInterval)
|
|
44
|
+
clearInterval(heartbeatInterval);
|
|
45
|
+
heartbeatInterval = setInterval(() => {
|
|
46
|
+
socket.emit('heartbeat', { subdomain: fullId });
|
|
47
|
+
}, 30000);
|
|
39
48
|
const pathParts = data.url.split('/hook/')[1];
|
|
40
49
|
console.log(chalk_1.default.green(`š Dashboard: ${PRODUCTION_DASHBOARD_URL}/dashboard/${pathParts}`));
|
|
41
50
|
console.log(chalk_1.default.yellow(`Waiting for requests...\n`));
|
|
@@ -100,5 +109,7 @@ socket.on("incoming-request", async (payload, callback) => {
|
|
|
100
109
|
}
|
|
101
110
|
});
|
|
102
111
|
socket.on('disconnect', () => {
|
|
112
|
+
if (heartbeatInterval)
|
|
113
|
+
clearInterval(heartbeatInterval);
|
|
103
114
|
console.log(chalk_1.default.red('\nš Disconnected from Proxy. Retrying...'));
|
|
104
115
|
});
|