laplace-api 1.2.0 → 1.2.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,6 +1,6 @@
1
1
  {
2
2
  "name": "laplace-api",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Client library for Laplace API for the US stock market and BIST (Istanbul stock market) fundamental financial data.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -244,10 +244,12 @@ export class LivePriceWebSocketClient {
244
244
  this.reconnectTimeout = setTimeout(async () => {
245
245
  try {
246
246
  await this.connect(url);
247
+
248
+ this.isClosed = false
249
+
247
250
  const activeSymbols = this.getActiveSymbols();
248
- if (activeSymbols.length > 0) {
249
- this.addSymbols(activeSymbols);
250
- }
251
+ this.addSymbols(activeSymbols);
252
+
251
253
  if (this.reconnectTimeout) {
252
254
  clearTimeout(this.reconnectTimeout);
253
255
  this.reconnectTimeout = null;
@@ -273,9 +275,7 @@ export class LivePriceWebSocketClient {
273
275
  symbolsToAdd.push(symbol);
274
276
  }
275
277
  }
276
- if (symbolsToAdd.length > 0) {
277
- this.addSymbols(symbolsToAdd);
278
- }
278
+ this.addSymbols(symbolsToAdd);
279
279
 
280
280
  return () => {
281
281
  this.subscriptions.delete(subscriptionId);
@@ -295,6 +295,8 @@ export class LivePriceWebSocketClient {
295
295
  }
296
296
 
297
297
  private async removeSymbols(symbols: string[]) {
298
+ if (symbols.length === 0) return;
299
+
298
300
  if (!this.ws) {
299
301
  throw new WebSocketError(
300
302
  "WebSocket is not initialized",
@@ -317,6 +319,8 @@ export class LivePriceWebSocketClient {
317
319
  }
318
320
 
319
321
  private async addSymbols(symbols: string[]) {
322
+ if (symbols.length === 0) return;
323
+
320
324
  if (!this.ws) {
321
325
  throw new WebSocketError(
322
326
  "WebSocket is not initialized",