laplace-api 1.3.1 → 1.3.2
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/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { WebSocket } from "ws";
|
|
2
|
+
|
|
1
3
|
export interface BISTStockLiveData {
|
|
2
4
|
symbol: string;
|
|
3
5
|
cl: number; // Close
|
|
@@ -68,7 +70,7 @@ export class LivePriceWebSocketClient {
|
|
|
68
70
|
this.options = {
|
|
69
71
|
enableLogging: true,
|
|
70
72
|
reconnectAttempts: 5,
|
|
71
|
-
reconnectDelay:
|
|
73
|
+
reconnectDelay: 5000,
|
|
72
74
|
maxReconnectDelay: 30000,
|
|
73
75
|
...options,
|
|
74
76
|
};
|
|
@@ -136,7 +138,7 @@ export class LivePriceWebSocketClient {
|
|
|
136
138
|
this.ws.onerror = (error) => {
|
|
137
139
|
reject(
|
|
138
140
|
new WebSocketError(
|
|
139
|
-
`WebSocket connection error: ${error}`,
|
|
141
|
+
`WebSocket connection error: ${error.error}`,
|
|
140
142
|
WebSocketErrorType.CONNECTION_ERROR
|
|
141
143
|
)
|
|
142
144
|
);
|
|
@@ -264,7 +266,11 @@ export class LivePriceWebSocketClient {
|
|
|
264
266
|
} catch (error) {
|
|
265
267
|
this.attemptReconnect();
|
|
266
268
|
}
|
|
267
|
-
}, delay)
|
|
269
|
+
}, delay);
|
|
270
|
+
|
|
271
|
+
if (typeof process !== "undefined") {
|
|
272
|
+
this.reconnectTimeout.unref();
|
|
273
|
+
}
|
|
268
274
|
}
|
|
269
275
|
|
|
270
276
|
subscribe(
|