@ipcom/asterisk-ari 0.0.152 → 0.0.154

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/esm/index.js CHANGED
@@ -2315,7 +2315,7 @@ var Sounds = class {
2315
2315
  var import_exponential_backoff = __toESM(require_backoff(), 1);
2316
2316
  import { EventEmitter as EventEmitter3 } from "events";
2317
2317
  import WebSocket from "ws";
2318
- var DEFAULT_MAX_RECONNECT_ATTEMPTS = 10;
2318
+ var DEFAULT_MAX_RECONNECT_ATTEMPTS = 30;
2319
2319
  var DEFAULT_STARTING_DELAY = 500;
2320
2320
  var DEFAULT_MAX_DELAY = 1e4;
2321
2321
  var WebSocketClient = class extends EventEmitter3 {
@@ -2532,9 +2532,32 @@ var WebSocketClient = class extends EventEmitter3 {
2532
2532
  );
2533
2533
  }
2534
2534
  }
2535
+ /**
2536
+ * Checks if the WebSocket connection is currently open and active.
2537
+ *
2538
+ * This method provides a way to determine the current state of the WebSocket connection.
2539
+ * It checks if the WebSocket's readyState property is equal to WebSocket.OPEN,
2540
+ * which indicates an active connection.
2541
+ *
2542
+ * @returns {boolean} True if the WebSocket connection is open and active, false otherwise.
2543
+ */
2535
2544
  isConnected() {
2536
2545
  return this.ws?.readyState === WebSocket.OPEN;
2537
2546
  }
2547
+ /**
2548
+ * Retrieves the current state of the WebSocket connection.
2549
+ *
2550
+ * This method provides a way to check the current state of the WebSocket connection.
2551
+ * It returns a number corresponding to one of the WebSocket readyState values:
2552
+ * - 0 (CONNECTING): The connection is not yet open.
2553
+ * - 1 (OPEN): The connection is open and ready to communicate.
2554
+ * - 2 (CLOSING): The connection is in the process of closing.
2555
+ * - 3 (CLOSED): The connection is closed or couldn't be opened.
2556
+ *
2557
+ * If the WebSocket instance doesn't exist, it returns WebSocket.CLOSED (3).
2558
+ *
2559
+ * @returns {number} A number representing the current state of the WebSocket connection.
2560
+ */
2538
2561
  getState() {
2539
2562
  return this.ws?.readyState ?? WebSocket.CLOSED;
2540
2563
  }