iosignal 9.19.0 → 9.22.0
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/README.ko.md +22 -2
- package/README.md +33 -2
- package/dist/browser/esm/broker.js +24 -0
- package/dist/browser/esm/broker.js.map +1 -0
- package/dist/browser/esm/io.d.ts +28 -0
- package/dist/browser/esm/io.js +4 -4
- package/dist/browser/esm/io.js.map +1 -1
- package/dist/browser/iife/io.js +4 -4
- package/dist/browser/iife/io.js.map +1 -1
- package/dist/node/iosignal.cjs +400 -141
- package/dist/node/iosignal.d.cts +45 -6
- package/dist/node/iosignal.d.ts +45 -6
- package/dist/node/iosignal.js +400 -142
- package/dist/types/client/IOCore.d.ts +14 -0
- package/dist/types/client/browser/IOWebSocket.d.ts +14 -0
- package/dist/types/common/constants.d.ts +8 -0
- package/package.json +4 -1
|
@@ -63,6 +63,16 @@ export class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
63
63
|
* @type {number}
|
|
64
64
|
*/
|
|
65
65
|
lastTxRxTime: number;
|
|
66
|
+
/**
|
|
67
|
+
* Last time anything was received from the server (see keepAlive()).
|
|
68
|
+
* @type {number}
|
|
69
|
+
*/
|
|
70
|
+
lastRxTime: number;
|
|
71
|
+
/** @private Time of a PING that has had no answer yet; 0 when none is pending. */
|
|
72
|
+
private _pingSentAt;
|
|
73
|
+
/** @private Connections closed since the last ready, and the earliest time of the next automatic attempt. */
|
|
74
|
+
private _reconnectAttempts;
|
|
75
|
+
_nextConnectAt: number;
|
|
66
76
|
/**
|
|
67
77
|
* Period for connection checker.
|
|
68
78
|
* @type {number}
|
|
@@ -182,6 +192,10 @@ export class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
182
192
|
* is implemented keepConnection() in the child classes (IOWS, IOCongSocket, etc.).
|
|
183
193
|
*/
|
|
184
194
|
keepAlive(): void;
|
|
195
|
+
/** @private When keepAlive() may connect again after this close: see SIZE_LIMIT.RECONNECT_*. */
|
|
196
|
+
private scheduleReconnect;
|
|
197
|
+
/** @private True from the socket opening until it closes (any state a server message can arrive in). */
|
|
198
|
+
private isLinkUp;
|
|
185
199
|
/**
|
|
186
200
|
* Redirects the connection to a new URL.
|
|
187
201
|
* @param {string} url2 - The new URL to redirect to.
|
|
@@ -33,6 +33,13 @@ export default class IO extends IOCore {
|
|
|
33
33
|
* @type {object}
|
|
34
34
|
*/
|
|
35
35
|
static constants: object;
|
|
36
|
+
/**
|
|
37
|
+
* The WebSocket class to connect with; null uses the global WebSocket. Set it on IO or on a
|
|
38
|
+
* subclass to connect through something with the browser WebSocket API (readyState,
|
|
39
|
+
* binaryType, onopen/onmessage/onerror/onclose, send, close), e.g. a test double.
|
|
40
|
+
* @type {(new (url: string) => WebSocket) | null}
|
|
41
|
+
*/
|
|
42
|
+
static WebSocket: (new (url: string) => WebSocket) | null;
|
|
36
43
|
/**
|
|
37
44
|
* Tracks the number of IO instances created.
|
|
38
45
|
* @type {number}
|
|
@@ -52,6 +59,13 @@ export default class IO extends IOCore {
|
|
|
52
59
|
* Keeps the connection alive by re-connecting if closed.
|
|
53
60
|
*/
|
|
54
61
|
keepConnection(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Makes the socket for a connection: new IO.WebSocket(url) (the class set on this client's
|
|
64
|
+
* class), else the global WebSocket. Override it to choose the socket by URL.
|
|
65
|
+
* @param {string} url - The URL to connect to.
|
|
66
|
+
* @returns {WebSocket}
|
|
67
|
+
*/
|
|
68
|
+
createWebSocket(url: string): WebSocket;
|
|
55
69
|
/**
|
|
56
70
|
* Creates a new WebSocket connection.
|
|
57
71
|
* @param {string} url - The WebSocket URL to connect to.
|
|
@@ -45,6 +45,10 @@ export type SIZE_LIMIT = {
|
|
|
45
45
|
TAG_LEN2: number;
|
|
46
46
|
CONNECTION_CHECKER_PERIOD: number;
|
|
47
47
|
CLIENT_PING_PERIOD: number;
|
|
48
|
+
PONG_TIMEOUT: number;
|
|
49
|
+
RECONNECT_JITTER: number;
|
|
50
|
+
RECONNECT_BASE: number;
|
|
51
|
+
RECONNECT_MAX: number;
|
|
48
52
|
SERVER_HELLO_TIMEOUT: number;
|
|
49
53
|
PROMISE_TIMEOUT: number;
|
|
50
54
|
DID: number;
|
|
@@ -55,6 +59,10 @@ export namespace SIZE_LIMIT {
|
|
|
55
59
|
let TAG_LEN2: number;
|
|
56
60
|
let CONNECTION_CHECKER_PERIOD: number;
|
|
57
61
|
let CLIENT_PING_PERIOD: number;
|
|
62
|
+
let PONG_TIMEOUT: number;
|
|
63
|
+
let RECONNECT_JITTER: number;
|
|
64
|
+
let RECONNECT_BASE: number;
|
|
65
|
+
let RECONNECT_MAX: number;
|
|
58
66
|
let SERVER_HELLO_TIMEOUT: number;
|
|
59
67
|
let PROMISE_TIMEOUT: number;
|
|
60
68
|
let DID: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iosignal",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.22.0",
|
|
4
4
|
"description": "iosignal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"types": "./dist/browser/esm/io.d.ts",
|
|
23
23
|
"default": "./dist/browser/esm/io.js"
|
|
24
24
|
},
|
|
25
|
+
"./broker": "./dist/browser/esm/broker.js",
|
|
25
26
|
"./browser/*": "./dist/browser/*"
|
|
26
27
|
},
|
|
27
28
|
"types": "./dist/node/iosignal.d.ts",
|
|
@@ -80,6 +81,8 @@
|
|
|
80
81
|
"auth"
|
|
81
82
|
],
|
|
82
83
|
"files": [
|
|
84
|
+
"dist/browser/esm/broker.js",
|
|
85
|
+
"dist/browser/esm/broker.js.map",
|
|
83
86
|
"dist/browser/esm/io.d.ts",
|
|
84
87
|
"dist/browser/esm/io.js",
|
|
85
88
|
"dist/browser/esm/io.js.map",
|