iosignal 7.1.0 → 8.0.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 +64 -191
- package/README.md +68 -226
- package/dist/browser/esm/io.d.ts +36 -19
- package/dist/browser/esm/io.js +3 -3
- package/dist/browser/esm/io.js.map +1 -1
- package/dist/browser/iife/io.js +3 -3
- package/dist/browser/iife/io.js.map +1 -1
- package/dist/node/iosignal.cjs +467 -295
- package/dist/node/iosignal.d.cts +73 -24
- package/dist/node/iosignal.d.ts +73 -24
- package/dist/node/iosignal.js +467 -295
- package/dist/types/client/IOCore.d.ts +35 -18
- package/dist/types/client/browser/IOWebSocket.d.ts +1 -1
- package/package.json +1 -1
package/dist/browser/esm/io.d.ts
CHANGED
|
@@ -146,6 +146,12 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
146
146
|
* @type {Map<string, Set<string>>}
|
|
147
147
|
*/
|
|
148
148
|
linkMap: Map<string, Set<string>>;
|
|
149
|
+
/** @private @type {Map<string, Map<string, Set<Function>>>} */
|
|
150
|
+
private _linkHandlers;
|
|
151
|
+
/** @private @type {Set<string>} */
|
|
152
|
+
private _listenTags;
|
|
153
|
+
/** @private @type {Set<string>} */
|
|
154
|
+
private _manualSubscriptions;
|
|
149
155
|
/**
|
|
150
156
|
* Indicates if auto-reconnect is enabled.
|
|
151
157
|
* @type {boolean}
|
|
@@ -172,7 +178,9 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
172
178
|
stop(): void;
|
|
173
179
|
/**
|
|
174
180
|
* Permanently destroys the instance, cleaning up all resources.
|
|
175
|
-
* The instance will not be usable after this.
|
|
181
|
+
* The instance will not be usable after this. Later signal()/publish()/subscribe()
|
|
182
|
+
* calls are silently dropped, the same as sends while disconnected, and call()
|
|
183
|
+
* rejects with code 'CONNECTION_CLOSED'.
|
|
176
184
|
*/
|
|
177
185
|
destroy(): void;
|
|
178
186
|
/**
|
|
@@ -255,6 +263,7 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
255
263
|
getEncryptionMode(): boolean;
|
|
256
264
|
/**
|
|
257
265
|
* Sends data with encryption based on the encryption mode.
|
|
266
|
+
* Like an unconnected socket, a destroyed instance silently drops the data.
|
|
258
267
|
* @param {Buffer} data - The data buffer to send.
|
|
259
268
|
* @param {boolean} [useEncryption] - Optional. Force encryption or not. If undefined, uses default policy.
|
|
260
269
|
*/
|
|
@@ -323,7 +332,7 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
323
332
|
/**
|
|
324
333
|
* Subscribes to a channel or channels.
|
|
325
334
|
* @param {string} tag - The tag(s) of the channel(s) to subscribe to (comma-separated).
|
|
326
|
-
* @throws {TypeError} If tag is
|
|
335
|
+
* @throws {TypeError} If tag is invalid, exceeds the length limit, or contains a direct-receive subscription.
|
|
327
336
|
*/
|
|
328
337
|
subscribe(tag: string): void;
|
|
329
338
|
/**
|
|
@@ -334,41 +343,49 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
334
343
|
/**
|
|
335
344
|
* Unsubscribes from a channel or channels.
|
|
336
345
|
* @param {string} [tag=""] - The tag(s) of the channel(s) to unsubscribe from (comma-separated). If empty, unsubscribes from all.
|
|
337
|
-
* @throws {TypeError} If tag is
|
|
346
|
+
* @throws {TypeError} If tag is invalid, exceeds the length limit, or contains a direct-receive subscription.
|
|
338
347
|
*/
|
|
339
348
|
unsubscribe(tag?: string): void;
|
|
340
349
|
/**
|
|
341
350
|
* Convenience API for simple clients (for example, CLI tools): register a
|
|
342
|
-
* tag handler once and remember its subscription in channels.
|
|
343
|
-
* connection readiness; the CID-ready flow subscribes on initial connection
|
|
351
|
+
* tag handler once and remember its subscription in channels. For subscription
|
|
352
|
+
* tags, register before connection readiness; the CID-ready flow subscribes on initial connection
|
|
344
353
|
* and again after reconnect, without application-level ready/subscribe code.
|
|
345
354
|
* This does not send a subscription immediately, even if already ready.
|
|
346
355
|
* For precise subscription/send ordering or dynamic subscriptions, use
|
|
347
|
-
* on() with subscribe() in a ready handler instead.
|
|
356
|
+
* on() with subscribe() in a ready handler instead.
|
|
357
|
+
* Direct signals need no subscription: use on/listen('@') for all direct
|
|
358
|
+
* signals, or on/listen('@topic') for an exact topic. Direct handlers can be
|
|
359
|
+
* registered before or after readiness, before the message arrives.
|
|
360
|
+
* Dispatch is synchronous: '@' first, then '@topic' when tag is not '@'.
|
|
361
|
+
* Returning false does not cancel dispatch; a thrown error interrupts it.
|
|
348
362
|
* @param {string} tag - The tag to listen on.
|
|
349
363
|
* @param {Function} handler - The callback function to handle the signal.
|
|
350
364
|
* @throws {TypeError} If tag is not a string, handler is not a function, or tag length is invalid.
|
|
351
365
|
*/
|
|
352
366
|
listen(tag: string, handler: Function): void;
|
|
353
367
|
/**
|
|
354
|
-
*
|
|
355
|
-
* @
|
|
356
|
-
*
|
|
357
|
-
* @param {
|
|
358
|
-
* @
|
|
368
|
+
* Associates handlers with a local component for scoped teardown.
|
|
369
|
+
* Direct tags (@ or @topic) only register local handlers. Other tags also
|
|
370
|
+
* subscribe now and are remembered for reconnection.
|
|
371
|
+
* @param {string} to - The local component identifier, not a server target.
|
|
372
|
+
* @param {string} tag - The exact event tag.
|
|
373
|
+
* @param {Function} handler - The callback receiving (tag, ...args).
|
|
374
|
+
* @throws {TypeError} If the arguments or subscription tags are invalid.
|
|
359
375
|
*/
|
|
360
376
|
link(to: string, tag: string, handler: Function): void;
|
|
361
377
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
* @param {string}
|
|
365
|
-
* @
|
|
378
|
+
* Removes only one local component's handlers for a tag. Direct tags never
|
|
379
|
+
* send an unsubscribe. Shared subscriptions and explicit subscriptions remain.
|
|
380
|
+
* @param {string} to - The local component identifier.
|
|
381
|
+
* @param {string} tag - The exact linked tag.
|
|
382
|
+
* @throws {TypeError} If the arguments are invalid.
|
|
366
383
|
*/
|
|
367
384
|
unlink(to: string, tag: string): void;
|
|
368
385
|
/**
|
|
369
|
-
*
|
|
370
|
-
* @param {string} to - The local
|
|
371
|
-
* @throws {TypeError} If
|
|
386
|
+
* Removes this local component's links without removing other listeners.
|
|
387
|
+
* @param {string} to - The local component identifier.
|
|
388
|
+
* @throws {TypeError} If the component identifier is not a string.
|
|
372
389
|
*/
|
|
373
390
|
unlinkAll(to: string): void;
|
|
374
391
|
/**
|
|
@@ -490,7 +507,7 @@ declare class IO extends IOCore {
|
|
|
490
507
|
*/
|
|
491
508
|
onWebSocketMessageBlob(event: MessageEvent): Promise<void>;
|
|
492
509
|
/**
|
|
493
|
-
* Sends data over the WebSocket.
|
|
510
|
+
* Sends data over the WebSocket. Data is dropped while the socket is not open.
|
|
494
511
|
* @param {BufferSource} data - The data to send.
|
|
495
512
|
*/
|
|
496
513
|
socket_send(data: BufferSource): void;
|