@clonegod/ttd-core 2.0.77 → 2.0.78
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/ws/ws_client.d.ts +1 -0
- package/dist/ws/ws_client.js +9 -0
- package/package.json +1 -1
package/dist/ws/ws_client.d.ts
CHANGED
package/dist/ws/ws_client.js
CHANGED
|
@@ -23,6 +23,7 @@ class WebSocketClient {
|
|
|
23
23
|
this.keepAliveTimer = null;
|
|
24
24
|
this.url = url;
|
|
25
25
|
this.options = Object.assign({ reconnectInterval: 3000, rejectUnauthorized: false, keepAlive: false, keepAliveInterval: 30000 }, options);
|
|
26
|
+
this.setupGlobalErrorHandlers();
|
|
26
27
|
(0, dist_1.log_info)(`WebSocketClient constructor, url: ${this.url}`, this.options);
|
|
27
28
|
}
|
|
28
29
|
connect() {
|
|
@@ -122,5 +123,13 @@ class WebSocketClient {
|
|
|
122
123
|
(0, dist_1.log_info)('KeepAlive stopped');
|
|
123
124
|
}
|
|
124
125
|
}
|
|
126
|
+
setupGlobalErrorHandlers() {
|
|
127
|
+
process.on('uncaughtException', (error) => {
|
|
128
|
+
(0, dist_1.log_error)('Uncaught Exception in WebSocketClient:', error);
|
|
129
|
+
});
|
|
130
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
131
|
+
(0, dist_1.log_error)('Unhandled Rejection in WebSocketClient:', reason instanceof Error ? reason : new Error(String(reason)));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
125
134
|
}
|
|
126
135
|
exports.WebSocketClient = WebSocketClient;
|