iosignal 3.0.0 → 3.0.1

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.
Files changed (35) hide show
  1. package/README.md +144 -1
  2. package/dist/io.d.ts +481 -0
  3. package/dist/io.js +3 -3
  4. package/dist/io.js.map +1 -1
  5. package/dist/io.min.js +3 -3
  6. package/dist/io.min.js.map +1 -1
  7. package/dist/iosignal.js +543 -102
  8. package/dist/types/client/IOCore.d.ts +408 -0
  9. package/dist/types/client/browser/IOWebSocket.d.ts +75 -0
  10. package/dist/types/common/constants.d.ts +169 -0
  11. package/dist/types/common/payload.d.ts +6 -0
  12. package/dist/types/common/quotaTable.d.ts +47 -0
  13. package/docs/{README.kr.md → README.ko.md} +143 -2
  14. package/examples/react-chat-js/dist/assets/index-Cy4qaVcJ.js +56 -0
  15. package/examples/react-chat-js/dist/assets/index-NETrjYhz.css +1 -0
  16. package/examples/react-chat-js/dist/index.html +14 -0
  17. package/examples/react-chat-js/index.html +13 -0
  18. package/examples/react-chat-js/package-lock.json +1628 -0
  19. package/examples/react-chat-js/package.json +20 -0
  20. package/examples/react-chat-js/src/App.css +61 -0
  21. package/examples/react-chat-js/src/App.jsx +125 -0
  22. package/examples/react-chat-js/src/index.css +13 -0
  23. package/examples/react-chat-js/src/main.jsx +13 -0
  24. package/examples/react-chat-js/src/shared_io.js +12 -0
  25. package/examples/react-chat-js/vite.config.js +7 -0
  26. package/examples/server/index.js +12 -0
  27. package/examples/server/package.json +12 -0
  28. package/package.json +9 -3
  29. package/rollup.config.js +11 -4
  30. package/src/client/IOCongSocket.js +20 -9
  31. package/src/client/IOCore.js +422 -77
  32. package/src/client/IOWS.js +12 -15
  33. package/src/client/browser/IOWebSocket.js +112 -13
  34. package/src/common/constants.js +91 -1
  35. package/tsconfig.json +24 -0
@@ -0,0 +1,408 @@
1
+ /**
2
+ * Core class for handling WebSocket communication.
3
+ * @augments {EventEmitter}
4
+ */
5
+ export class IOCore extends EventEmitter<string | symbol, any> {
6
+ /**
7
+ * @param {string} url - The WebSocket URL to connect to.
8
+ */
9
+ constructor(url: string);
10
+ /**
11
+ * Client ID received from the server.
12
+ * @type {string}
13
+ */
14
+ cid: string;
15
+ /**
16
+ * IP address received from the server.
17
+ * @type {string}
18
+ */
19
+ ip: string;
20
+ /**
21
+ * The WebSocket instance.
22
+ * @type {WebSocket | null}
23
+ */
24
+ socket: WebSocket | null;
25
+ /**
26
+ * The default server URL.
27
+ * @type {string}
28
+ */
29
+ url: string;
30
+ /**
31
+ * Current connection state (number).
32
+ * @type {number}
33
+ */
34
+ state: number;
35
+ /**
36
+ * Current connection state (string).
37
+ * @type {string}
38
+ */
39
+ stateName: string;
40
+ /**
41
+ * Transmitted message counter.
42
+ * @type {number}
43
+ */
44
+ txCounter: number;
45
+ /**
46
+ * Received message counter.
47
+ * @type {number}
48
+ */
49
+ rxCounter: number;
50
+ /**
51
+ * Transmitted bytes counter.
52
+ * @type {number}
53
+ */
54
+ txBytes: number;
55
+ /**
56
+ * Received bytes counter.
57
+ * @type {number}
58
+ */
59
+ rxBytes: number;
60
+ /**
61
+ * Last transmit/receive time.
62
+ * @type {number}
63
+ */
64
+ lastTxRxTime: number;
65
+ /**
66
+ * Period for connection checker.
67
+ * @type {number}
68
+ */
69
+ connectionCheckerPeriod: number;
70
+ /**
71
+ * Interval ID for connection checker.
72
+ * @type {NodeJS.Timeout | null}
73
+ */
74
+ connectionCheckerIntervalID: NodeJS.Timeout | null;
75
+ /**
76
+ * Boho instance for encryption/decryption.
77
+ * @type {Boho}
78
+ */
79
+ boho: Boho;
80
+ /**
81
+ * Indicates if the connection is TLS (wss).
82
+ * @type {boolean}
83
+ */
84
+ TLS: boolean;
85
+ /**
86
+ * Encryption mode.
87
+ * @type {number}
88
+ */
89
+ encMode: number;
90
+ /**
91
+ * Indicates if authentication is used.
92
+ * @type {boolean}
93
+ */
94
+ useAuth: boolean;
95
+ /**
96
+ * Nickname.
97
+ * @type {string}
98
+ */
99
+ nick: string;
100
+ /**
101
+ * Set of subscribed channels.
102
+ * @type {Set<string>}
103
+ */
104
+ channels: Set<string>;
105
+ /**
106
+ * Map of promises for message responses.
107
+ * @type {Map<number, Array<Function>>}
108
+ */
109
+ promiseMap: Map<number, Array<Function>>;
110
+ /**
111
+ * Timeout for message promises.
112
+ * @type {number}
113
+ */
114
+ promiseTimeOut: number;
115
+ /**
116
+ * Message ID for promises.
117
+ * @type {number}
118
+ */
119
+ mid: number;
120
+ /**
121
+ * Quota level.
122
+ * @type {number}
123
+ */
124
+ level: number;
125
+ /**
126
+ * Quota table for current level.
127
+ * @type {object}
128
+ */
129
+ quota: object;
130
+ /**
131
+ * Server settings.
132
+ * @type {object}
133
+ */
134
+ serverSet: object;
135
+ /**
136
+ * Map of linked channels.
137
+ * @type {Map<string, Set<string>>}
138
+ */
139
+ linkMap: Map<string, Set<string>>;
140
+ /**
141
+ * Indicates if auto-reconnect is enabled.
142
+ * @type {boolean}
143
+ * @default true
144
+ * */
145
+ autoReconnect: boolean;
146
+ /**
147
+ * A flag to prevent duplicate close operations.
148
+ * @type {boolean}
149
+ * @private
150
+ */
151
+ private _closed;
152
+ /**
153
+ * Performs common cleanup for the connection. It clears pending promises,
154
+ * resets the socket reference, and sets the state to closed.
155
+ * This method is guarded to only run once.
156
+ * If autoReconnect is false, it also clears the keep-alive timer.
157
+ */
158
+ close(): void;
159
+ /**
160
+ * Disables auto-reconnect and closes the current connection.
161
+ * The instance can be re-opened manually later. For complete cleanup, use destroy().
162
+ */
163
+ stop(): void;
164
+ /**
165
+ * Permanently destroys the instance, cleaning up all resources.
166
+ * The instance will not be usable after this.
167
+ */
168
+ destroy(): void;
169
+ /**
170
+ * The core keep-alive logic. It checks if auto-reconnect is enabled.
171
+ * The actual check for the socket's state is implemented in the child classes.
172
+ */
173
+ keepAlive(): void;
174
+ /**
175
+ * Redirects the connection to a new URL.
176
+ * @param {string} url2 - The new URL to redirect to.
177
+ */
178
+ redirect(url2: string): void;
179
+ /**
180
+ * Opens the WebSocket connection.
181
+ * @param {string} [url] - Optional URL to connect to. If not provided, uses the instance's URL.
182
+ */
183
+ open(url?: string): void;
184
+ /**
185
+ * Handles the 'open' event of the WebSocket. Resets the closed flag and sets the state to open.
186
+ */
187
+ onOpen(): void;
188
+ /**
189
+ * Handles the 'close' event of the WebSocket.
190
+ */
191
+ onClose(): void;
192
+ /**
193
+ * Manually logs in with provided ID and key.
194
+ * @param {string} id - The user ID.
195
+ * @param {string} key - The user key.
196
+ * @returns {boolean}
197
+ */
198
+ login(id: string, key: string): boolean;
199
+ /**
200
+ * Sets up authentication for auto-login.
201
+ * @param {string} id - The user ID.
202
+ * @param {string} key - The user key.
203
+ * @returns {boolean}
204
+ */
205
+ auth(id: string, key: string): boolean;
206
+ /**
207
+ * Handles incoming data from the WebSocket.
208
+ * @param {Buffer} buffer - The incoming data buffer.
209
+ */
210
+ onData(buffer: Buffer): void;
211
+ /**
212
+ * Sends an IAM (I Am) message to the server.
213
+ * @param {string} [title] - Optional title for the IAM message.
214
+ */
215
+ iam(title?: string): void;
216
+ /**
217
+ * Sends a PING message to the server.
218
+ */
219
+ ping(): void;
220
+ /**
221
+ * Sends a PONG message to the server.
222
+ */
223
+ pong(): void;
224
+ /**
225
+ * Sends an ECHO message to the server.
226
+ * @param {*} [args] - Optional arguments to echo.
227
+ */
228
+ echo(args?: any): void;
229
+ /**
230
+ * Sends binary data.
231
+ * @param {...any} data - Data to send.
232
+ */
233
+ bin(...data: any[]): void;
234
+ /**
235
+ * Sends data over the WebSocket.
236
+ * @param {Buffer} data - The data buffer to send.
237
+ */
238
+ send(data: Buffer): void;
239
+ /**
240
+ * Determines if encryption should be used based on current mode and TLS status.
241
+ * @returns {boolean}
242
+ */
243
+ getEncryptionMode(): boolean;
244
+ /**
245
+ * Sends data with encryption based on the encryption mode.
246
+ * @param {Buffer} data - The data buffer to send.
247
+ * @param {boolean} [useEncryption] - Optional. Force encryption or not. If undefined, uses default policy.
248
+ */
249
+ send_enc_mode(data: Buffer, useEncryption?: boolean): void;
250
+ /**
251
+ * Sets a message promise for a given message ID.
252
+ * @param {number} mid - The message ID.
253
+ * @returns {Promise<any>}
254
+ */
255
+ setMsgPromise(mid: number): Promise<any>;
256
+ /**
257
+ * Tests and resolves/rejects a promise based on the incoming buffer.
258
+ * @param {Buffer} buffer - The incoming data buffer.
259
+ */
260
+ testPromise(buffer: Buffer): void;
261
+ /**
262
+ * Publishes a signal.
263
+ * @param {...any} args - Arguments for the signal.
264
+ */
265
+ publish(...args: any[]): void;
266
+ /**
267
+ * Sends a signal with a tag and arguments.
268
+ * @param {string} tag - The signal tag.
269
+ * @param {...any} args - Arguments for the signal.
270
+ * @throws {TypeError} If tag is not a string.
271
+ */
272
+ signal(tag: string, ...args: any[]): void;
273
+ /**
274
+ * Decrypts E2E data.
275
+ * @param {Buffer} data - The encrypted data.
276
+ * @param {string} key - The decryption key.
277
+ * @returns {Buffer}
278
+ */
279
+ decrypt_e2e(data: Buffer, key: string): Buffer;
280
+ /**
281
+ * Sends an E2E (End-to-End) encrypted signal.
282
+ * @param {string} tag - The signal tag.
283
+ * @param {Buffer} data - The data to encrypt and send.
284
+ * @param {string} key - The encryption key.
285
+ * @throws {TypeError} If tag is not a string.
286
+ */
287
+ signal_e2e(tag: string, data: Buffer, key: string): void;
288
+ /**
289
+ * Sets a value in the store.
290
+ * @param {string} storeName - The name of the store.
291
+ * @param {...any} args - Arguments to set.
292
+ * @returns {Promise<any>}
293
+ */
294
+ set(storeName: string, ...args: any[]): Promise<any>;
295
+ /**
296
+ * Gets a value from the store.
297
+ * @param {string} storeName - The name of the store.
298
+ * @returns {Promise<any>}
299
+ */
300
+ get(storeName: string): Promise<any>;
301
+ /**
302
+ * Sends a request to a target and topic.
303
+ * @param {string} target - The target of the request.
304
+ * @param {string} topic - The topic of the request.
305
+ * @param {...any} args - Optional arguments for the request.
306
+ * @returns {Promise<any>}
307
+ */
308
+ req(target: string, topic: string, ...args: any[]): Promise<any>;
309
+ /**
310
+ * Subscribes to a channel or channels.
311
+ * @param {string} tag - The tag(s) of the channel(s) to subscribe to (comma-separated).
312
+ * @throws {TypeError} If tag is not a string or exceeds length limit.
313
+ */
314
+ subscribe(tag: string): void;
315
+ /**
316
+ * Subscribes to a channel or channels with a promise.
317
+ * @param {string} tag - The tag(s) of the channel(s) to subscribe to (comma-separated).
318
+ * @returns {Promise<any>}
319
+ * @throws {TypeError} If tag is not a string or exceeds length limit.
320
+ */
321
+ subscribe_promise(tag: string): Promise<any>;
322
+ /**
323
+ * Subscribes to channels stored in memory (local cache).
324
+ */
325
+ subscribe_memory_channels(): void;
326
+ /**
327
+ * Unsubscribes from a channel or channels.
328
+ * @param {string} [tag=""] - The tag(s) of the channel(s) to unsubscribe from (comma-separated). If empty, unsubscribes from all.
329
+ * @throws {TypeError} If tag is not a string or exceeds length limit.
330
+ */
331
+ unsubscribe(tag?: string): void;
332
+ /**
333
+ * Listens for signals on a specific tag.
334
+ * @param {string} tag - The tag to listen on.
335
+ * @param {Function} handler - The callback function to handle the signal.
336
+ * @throws {TypeError} If tag is not a string, handler is not a function, or tag length is invalid.
337
+ */
338
+ listen(tag: string, handler: Function): void;
339
+ /**
340
+ * Links a local target to a remote tag and sets up a handler.
341
+ * @param {string} to - The local link target.
342
+ * @param {string} tag - The remote tag.
343
+ * @param {Function} handler - The callback function to handle the signal.
344
+ * @throws {TypeError} If 'to' or 'tag' are not strings, handler is not a function, or tag length is invalid.
345
+ */
346
+ link(to: string, tag: string, handler: Function): void;
347
+ /**
348
+ * Unlinks a specific tag from a local target.
349
+ * @param {string} to - The local link target.
350
+ * @param {string} tag - The tag to unlink.
351
+ * @throws {TypeError} If 'to' or 'tag' are not strings or tag length is invalid.
352
+ */
353
+ unlink(to: string, tag: string): void;
354
+ /**
355
+ * Unlinks all tags from a local target.
356
+ * @param {string} to - The local link target.
357
+ * @throws {TypeError} If 'to' is not a string.
358
+ */
359
+ unlinkAll(to: string): void;
360
+ /**
361
+ * Gets connection metrics.
362
+ * @returns {{tx: number, rx: number, txb: number, rxb: number, last: number}}
363
+ */
364
+ getMetric(): {
365
+ tx: number;
366
+ rx: number;
367
+ txb: number;
368
+ rxb: number;
369
+ last: number;
370
+ };
371
+ /**
372
+ * Gets the current connection state.
373
+ * @returns {number}
374
+ */
375
+ getState(): number;
376
+ /**
377
+ * Gets the current connection state name.
378
+ * @returns {string}
379
+ */
380
+ getStateName(): string;
381
+ /**
382
+ * Gets security-related information.
383
+ * @returns {{useAuth: boolean, isTLS: boolean, isAuthorized: boolean, encMode: number, usingEncryption: boolean}}
384
+ */
385
+ getSecurity(): {
386
+ useAuth: boolean;
387
+ isTLS: boolean;
388
+ isAuthorized: boolean;
389
+ encMode: number;
390
+ usingEncryption: boolean;
391
+ };
392
+ /**
393
+ * Changes the connection state and emits events.
394
+ * @param {string} state - The new state name (e.g., 'ready', 'closed').
395
+ * @param {string} [emitEventAndMessage] - Optional message to emit with the state change event.
396
+ */
397
+ stateChange(state: string, emitEventAndMessage?: string): void;
398
+ }
399
+ export type MBP = import("meta-buffer-pack").MBP;
400
+ export type IOMsg = import("../common/constants.js").IOMsg;
401
+ export type PAYLOAD_TYPE = import("../common/constants.js").PAYLOAD_TYPE;
402
+ export type SIZE_LIMIT = import("../common/constants.js").SIZE_LIMIT;
403
+ export type ENC_MODE = import("../common/constants.js").ENC_MODE;
404
+ export type STATES = import("../common/constants.js").STATES;
405
+ export type quotaTable = any;
406
+ export type Boho = import("boho").Boho;
407
+ export type Buffer = import("boho").Buffer;
408
+ import EventEmitter from "eventemitter3";
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Browser WebSocket client extending IOCore.
3
+ * @augments {IOCore}
4
+ */
5
+ export default class IO extends IOCore {
6
+ /**
7
+ * The version of the client.
8
+ * @type {string}
9
+ */
10
+ static version: string;
11
+ /**
12
+ * The binary type for WebSocket messages.
13
+ * @type {string}
14
+ */
15
+ static binaryType: string;
16
+ /**
17
+ * The Boho library instance.
18
+ * @type {Boho}
19
+ */
20
+ static Boho: Boho;
21
+ /**
22
+ * The MBP (MessagePack-Boho) instance.
23
+ * @type {MBP}
24
+ */
25
+ static MBP: MBP;
26
+ /**
27
+ * The Buffer class from Boho.
28
+ * @type {Buffer}
29
+ */
30
+ static Buffer: Buffer;
31
+ /**
32
+ * Constants used by the client.
33
+ * @type {object}
34
+ */
35
+ static constants: object;
36
+ /**
37
+ * Tracks the number of IO instances created.
38
+ * @type {number}
39
+ */
40
+ static instanceCount: number;
41
+ /**
42
+ * Tracks the number of WebSocket objects created.
43
+ * @type {number}
44
+ */
45
+ static webSocketCount: number;
46
+ boundBrowserVisiblePing: any;
47
+ /**
48
+ * Pings the server when the browser tab becomes visible.
49
+ */
50
+ browserVisiblePing(): void;
51
+ /**
52
+ * Creates a new WebSocket connection.
53
+ * @param {string} url - The WebSocket URL to connect to.
54
+ */
55
+ createConnection(url: string): void;
56
+ /**
57
+ * Handles incoming WebSocket messages (arraybuffer type).
58
+ * @param {MessageEvent} event - The WebSocket message event.
59
+ */
60
+ onWebSocketMessage(event: MessageEvent): void;
61
+ /**
62
+ * Handles incoming WebSocket messages (blob type).
63
+ * @param {MessageEvent} event - The WebSocket message event.
64
+ */
65
+ onWebSocketMessageBlob(event: MessageEvent): Promise<void>;
66
+ /**
67
+ * Sends data over the WebSocket.
68
+ * @param {BufferSource} data - The data to send.
69
+ */
70
+ socket_send(data: BufferSource): void;
71
+ }
72
+ export type Boho = import("boho").Boho;
73
+ export type MBP = any;
74
+ export type Buffer = import("boho").Buffer;
75
+ import { IOCore } from "../IOCore.js";
@@ -0,0 +1,169 @@
1
+ export type STATES = {
2
+ OPENING: number;
3
+ OPEN: number;
4
+ CLOSING: number;
5
+ CLOSED: number;
6
+ SERVER_READY: number;
7
+ AUTH_FAIL: number;
8
+ AUTH_READY: number;
9
+ READY: number;
10
+ REDIRECTING: number;
11
+ };
12
+ export namespace STATES {
13
+ let OPENING: number;
14
+ let OPEN: number;
15
+ let CLOSING: number;
16
+ let CLOSED: number;
17
+ let SERVER_READY: number;
18
+ let AUTH_FAIL: number;
19
+ let AUTH_READY: number;
20
+ let READY: number;
21
+ let REDIRECTING: number;
22
+ }
23
+ export type CLIENT_STATE = {
24
+ INIT: number;
25
+ SENT_SERVER_READY: number;
26
+ RECV_AUTH_REQ: number;
27
+ SENT_SERVER_NONCE: number;
28
+ RECV_AUTH_HMAC: number;
29
+ AUTH_FAIL: number;
30
+ AUTH_READY: number;
31
+ CID_READY: number;
32
+ };
33
+ export namespace CLIENT_STATE {
34
+ export let INIT: number;
35
+ export let SENT_SERVER_READY: number;
36
+ export let RECV_AUTH_REQ: number;
37
+ export let SENT_SERVER_NONCE: number;
38
+ export let RECV_AUTH_HMAC: number;
39
+ let AUTH_FAIL_1: number;
40
+ export { AUTH_FAIL_1 as AUTH_FAIL };
41
+ let AUTH_READY_1: number;
42
+ export { AUTH_READY_1 as AUTH_READY };
43
+ export let CID_READY: number;
44
+ }
45
+ export type ENC_MODE = {
46
+ NO: number;
47
+ YES: number;
48
+ AUTO: number;
49
+ };
50
+ export namespace ENC_MODE {
51
+ let NO: number;
52
+ let YES: number;
53
+ let AUTO: number;
54
+ }
55
+ export type SIZE_LIMIT = {
56
+ TAG_LEN1: number;
57
+ TAG_LEN2: number;
58
+ CONNECTION_CHECKER_PERIOD: number;
59
+ PROMISE_TIMEOUT: number;
60
+ DID: number;
61
+ CID: number;
62
+ };
63
+ export namespace SIZE_LIMIT {
64
+ let TAG_LEN1: number;
65
+ let TAG_LEN2: number;
66
+ let CONNECTION_CHECKER_PERIOD: number;
67
+ let PROMISE_TIMEOUT: number;
68
+ let DID: number;
69
+ let CID: number;
70
+ }
71
+ export type PAYLOAD_TYPE = {
72
+ EMPTY: number;
73
+ TEXT: number;
74
+ BINARY: number;
75
+ OBJECT: number;
76
+ MJSON: number;
77
+ MBA: number;
78
+ };
79
+ export namespace PAYLOAD_TYPE {
80
+ let EMPTY: number;
81
+ let TEXT: number;
82
+ let BINARY: number;
83
+ let OBJECT: number;
84
+ let MJSON: number;
85
+ let MBA: number;
86
+ }
87
+ export type IOMsg = {
88
+ SERVER_READY: number;
89
+ CID_REQ: number;
90
+ CID_RES: number;
91
+ QUOTA_LEVEL: number;
92
+ SERVER_CLEAR_AUTH: number;
93
+ SERVER_REDIRECT: number;
94
+ LOOP: number;
95
+ ECHO: number;
96
+ PING: number;
97
+ PONG: number;
98
+ CLOSE: number;
99
+ SIGNAL: number;
100
+ SIGNAL_REQ: number;
101
+ SIGNAL_E2E: number;
102
+ SUBSCRIBE: number;
103
+ SUBSCRIBE_REQ: number;
104
+ UNSUBSCRIBE: number;
105
+ SERVER_SIGNAL: number;
106
+ IAM: number;
107
+ IAM_RES: number;
108
+ SET: number;
109
+ RESPONSE_CODE: number;
110
+ RESPONSE_MBP: number;
111
+ REQUEST: number;
112
+ RESPONSE: number;
113
+ FLOW_MODE: number;
114
+ WAIT: number;
115
+ RESUME: number;
116
+ TIME_OUT: number;
117
+ OVER_SIZE: number;
118
+ OVER_FLOW: number;
119
+ };
120
+ export namespace IOMsg {
121
+ let SERVER_READY_1: number;
122
+ export { SERVER_READY_1 as SERVER_READY };
123
+ export let CID_REQ: number;
124
+ export let CID_RES: number;
125
+ export let QUOTA_LEVEL: number;
126
+ export let SERVER_CLEAR_AUTH: number;
127
+ export let SERVER_REDIRECT: number;
128
+ export let LOOP: number;
129
+ export let ECHO: number;
130
+ export let PING: number;
131
+ export let PONG: number;
132
+ export let CLOSE: number;
133
+ export let SIGNAL: number;
134
+ export let SIGNAL_REQ: number;
135
+ export let SIGNAL_E2E: number;
136
+ export let SUBSCRIBE: number;
137
+ export let SUBSCRIBE_REQ: number;
138
+ export let UNSUBSCRIBE: number;
139
+ export let SERVER_SIGNAL: number;
140
+ export let IAM: number;
141
+ export let IAM_RES: number;
142
+ export let SET: number;
143
+ export let RESPONSE_CODE: number;
144
+ export let RESPONSE_MBP: number;
145
+ export let REQUEST: number;
146
+ export let RESPONSE: number;
147
+ export let FLOW_MODE: number;
148
+ export let WAIT: number;
149
+ export let RESUME: number;
150
+ export let TIME_OUT: number;
151
+ export let OVER_SIZE: number;
152
+ export let OVER_FLOW: number;
153
+ }
154
+ export type API_TYPE = {
155
+ REQUEST_RESPONSE: string;
156
+ ONE_WAY: string;
157
+ };
158
+ export namespace API_TYPE {
159
+ let REQUEST_RESPONSE: string;
160
+ let ONE_WAY: string;
161
+ }
162
+ export type STATUS = {
163
+ OK: number;
164
+ ERROR: number;
165
+ };
166
+ export namespace STATUS {
167
+ let OK: number;
168
+ let ERROR: number;
169
+ }
@@ -0,0 +1,6 @@
1
+ export function getSignalPack(tag: any, ...args: any[]): Buffer<ArrayBufferLike>;
2
+ export function parsePayload(args: any): {
3
+ type: number;
4
+ buffer: Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>;
5
+ };
6
+ export function getPayloadFromSignalPack(signalPack: any): any;
@@ -0,0 +1,47 @@
1
+ export let quotaTable: {
2
+ 0: {
3
+ signalSize: number;
4
+ publishCounter: number;
5
+ trafficRate: number;
6
+ };
7
+ 1: {
8
+ signalSize: number;
9
+ publishCounter: number;
10
+ trafficRate: number;
11
+ };
12
+ 2: {
13
+ signalSize: number;
14
+ publishCounter: number;
15
+ trafficRate: number;
16
+ };
17
+ 3: {
18
+ signalSize: number;
19
+ publishCounter: number;
20
+ trafficRate: number;
21
+ };
22
+ 10: {
23
+ signalSize: number;
24
+ publishCounter: number;
25
+ trafficRate: number;
26
+ };
27
+ 11: {
28
+ signalSize: number;
29
+ publishCounter: number;
30
+ trafficRate: number;
31
+ };
32
+ 12: {
33
+ signalSize: number;
34
+ publishCounter: number;
35
+ trafficRate: number;
36
+ };
37
+ 200: {
38
+ signalSize: number;
39
+ publishCounter: number;
40
+ trafficRate: number;
41
+ };
42
+ 255: {
43
+ signalSize: number;
44
+ publishCounter: number;
45
+ trafficRate: number;
46
+ };
47
+ };