@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/cjs/index.cjs
CHANGED
|
@@ -2335,7 +2335,7 @@ var Sounds = class {
|
|
|
2335
2335
|
var import_events3 = require("events");
|
|
2336
2336
|
var import_exponential_backoff = __toESM(require_backoff(), 1);
|
|
2337
2337
|
var import_ws = __toESM(require("ws"), 1);
|
|
2338
|
-
var DEFAULT_MAX_RECONNECT_ATTEMPTS =
|
|
2338
|
+
var DEFAULT_MAX_RECONNECT_ATTEMPTS = 30;
|
|
2339
2339
|
var DEFAULT_STARTING_DELAY = 500;
|
|
2340
2340
|
var DEFAULT_MAX_DELAY = 1e4;
|
|
2341
2341
|
var WebSocketClient = class extends import_events3.EventEmitter {
|
|
@@ -2552,9 +2552,32 @@ var WebSocketClient = class extends import_events3.EventEmitter {
|
|
|
2552
2552
|
);
|
|
2553
2553
|
}
|
|
2554
2554
|
}
|
|
2555
|
+
/**
|
|
2556
|
+
* Checks if the WebSocket connection is currently open and active.
|
|
2557
|
+
*
|
|
2558
|
+
* This method provides a way to determine the current state of the WebSocket connection.
|
|
2559
|
+
* It checks if the WebSocket's readyState property is equal to WebSocket.OPEN,
|
|
2560
|
+
* which indicates an active connection.
|
|
2561
|
+
*
|
|
2562
|
+
* @returns {boolean} True if the WebSocket connection is open and active, false otherwise.
|
|
2563
|
+
*/
|
|
2555
2564
|
isConnected() {
|
|
2556
2565
|
return this.ws?.readyState === import_ws.default.OPEN;
|
|
2557
2566
|
}
|
|
2567
|
+
/**
|
|
2568
|
+
* Retrieves the current state of the WebSocket connection.
|
|
2569
|
+
*
|
|
2570
|
+
* This method provides a way to check the current state of the WebSocket connection.
|
|
2571
|
+
* It returns a number corresponding to one of the WebSocket readyState values:
|
|
2572
|
+
* - 0 (CONNECTING): The connection is not yet open.
|
|
2573
|
+
* - 1 (OPEN): The connection is open and ready to communicate.
|
|
2574
|
+
* - 2 (CLOSING): The connection is in the process of closing.
|
|
2575
|
+
* - 3 (CLOSED): The connection is closed or couldn't be opened.
|
|
2576
|
+
*
|
|
2577
|
+
* If the WebSocket instance doesn't exist, it returns WebSocket.CLOSED (3).
|
|
2578
|
+
*
|
|
2579
|
+
* @returns {number} A number representing the current state of the WebSocket connection.
|
|
2580
|
+
*/
|
|
2558
2581
|
getState() {
|
|
2559
2582
|
return this.ws?.readyState ?? import_ws.default.CLOSED;
|
|
2560
2583
|
}
|