iosignal 4.7.0 → 4.8.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.md +0 -3
- package/dist/io.d.ts +3 -9
- package/dist/io.js +4 -4
- package/dist/io.js.map +1 -1
- package/dist/io.min.js +1 -1
- package/dist/io.min.js.map +1 -1
- package/dist/iosignal.js +14 -40
- package/dist/types/client/IOCore.d.ts +3 -9
- package/package.json +1 -1
- package/src/client/IOCore.js +12 -39
- package/src/server/Remote.js +1 -0
package/dist/iosignal.js
CHANGED
|
@@ -13,7 +13,7 @@ import require$$2, { networkInterfaces } from 'os';
|
|
|
13
13
|
import require$$0$1 from 'buffer';
|
|
14
14
|
import { memoryUsage } from 'process';
|
|
15
15
|
|
|
16
|
-
var version$1 = "4.
|
|
16
|
+
var version$1 = "4.8.0";
|
|
17
17
|
var pkg = {
|
|
18
18
|
version: version$1};
|
|
19
19
|
|
|
@@ -1215,7 +1215,7 @@ class IOCore extends EventEmitter {
|
|
|
1215
1215
|
|
|
1216
1216
|
// **IMPORTANT** change state before subscribe.
|
|
1217
1217
|
this.stateChange('ready', 'cid_ready');
|
|
1218
|
-
this.
|
|
1218
|
+
this.subscribe_channels();
|
|
1219
1219
|
break;
|
|
1220
1220
|
|
|
1221
1221
|
case IOMsg.QUOTA_LEVEL:
|
|
@@ -1484,6 +1484,7 @@ class IOCore extends EventEmitter {
|
|
|
1484
1484
|
console.log('## your maximum signalSize(bytes) is:', this.quota.signalSize);
|
|
1485
1485
|
return
|
|
1486
1486
|
}
|
|
1487
|
+
// console.log(`C->[${IOMsg[ data[0]]}]`)
|
|
1487
1488
|
this.socket_send(data);
|
|
1488
1489
|
}
|
|
1489
1490
|
|
|
@@ -1710,14 +1711,6 @@ class IOCore extends EventEmitter {
|
|
|
1710
1711
|
subscribe(tag) {
|
|
1711
1712
|
if (typeof tag !== 'string') throw TypeError('tag should be string.')
|
|
1712
1713
|
if (tag.length > SIZE_LIMIT.TAG_LEN1) throw TypeError('please check tag string length limit:' + SIZE_LIMIT.TAG_LEN1)
|
|
1713
|
-
if (this.state !== STATE.READY) return
|
|
1714
|
-
|
|
1715
|
-
// subscribe 사용시, 사용 'ready' 이벤트시 메뉴얼 등록되므로 여기에 등록하면 2중 호출된다.
|
|
1716
|
-
// 즉, channels 등록은 listen 같은 자동화 구독시만 사용.
|
|
1717
|
-
// let tagList = tag.split(',')
|
|
1718
|
-
// tagList.forEach(tag => {
|
|
1719
|
-
// this.channels.add(tag)
|
|
1720
|
-
// })
|
|
1721
1714
|
|
|
1722
1715
|
try {
|
|
1723
1716
|
let tagEncoded = encoder$1.encode(tag);
|
|
@@ -1727,47 +1720,27 @@ class IOCore extends EventEmitter {
|
|
|
1727
1720
|
M$1.NB('8', tagEncoded.byteLength),
|
|
1728
1721
|
tagEncoded]));
|
|
1729
1722
|
} catch (error) { }
|
|
1723
|
+
|
|
1730
1724
|
}
|
|
1731
1725
|
|
|
1726
|
+
|
|
1732
1727
|
/**
|
|
1733
|
-
* Subscribes
|
|
1734
|
-
*
|
|
1735
|
-
* @returns {Promise<any>}
|
|
1736
|
-
* @throws {TypeError} If tag is not a string or exceeds length limit.
|
|
1728
|
+
* Subscribes stored channels.
|
|
1729
|
+
* called client state become 'ready'
|
|
1737
1730
|
*/
|
|
1738
|
-
|
|
1739
|
-
if (
|
|
1740
|
-
if (
|
|
1741
|
-
|
|
1742
|
-
if (this.state !== STATE.READY) {
|
|
1743
|
-
return Promise.reject('subscribe_promise:: connection is not ready')
|
|
1744
|
-
}
|
|
1731
|
+
subscribe_channels() {
|
|
1732
|
+
if (this.state !== STATE.READY) return
|
|
1733
|
+
if (this.channels.size == 0) return
|
|
1734
|
+
let tag = Array.from(this.channels).join(',');
|
|
1745
1735
|
|
|
1746
1736
|
try {
|
|
1747
1737
|
let tagEncoded = encoder$1.encode(tag);
|
|
1748
1738
|
this.send_enc_mode(
|
|
1749
1739
|
Buffer$1.concat([
|
|
1750
|
-
M$1.NB('8', IOMsg.
|
|
1751
|
-
M$1.NB('
|
|
1752
|
-
M$1.NB('16', tagEncoded.byteLength),
|
|
1740
|
+
M$1.NB('8', IOMsg.SUBSCRIBE),
|
|
1741
|
+
M$1.NB('8', tagEncoded.byteLength),
|
|
1753
1742
|
tagEncoded]));
|
|
1754
|
-
return this.setMsgPromise(this.mid)
|
|
1755
1743
|
} catch (error) { }
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
/**
|
|
1759
|
-
* Subscribes to channels stored in memory (local cache).
|
|
1760
|
-
*/
|
|
1761
|
-
subscribe_memory_channels() { //local cache . auto_resubscribe
|
|
1762
|
-
if (this.channels.size == 0) return
|
|
1763
|
-
let chList = Array.from(this.channels).join(',');
|
|
1764
|
-
|
|
1765
|
-
this.subscribe_promise(chList)
|
|
1766
|
-
.then((res) => {
|
|
1767
|
-
// console.log('>> SUBSCRIBE_REQ result', res ) // return code == map.size
|
|
1768
|
-
}).catch((e) => {
|
|
1769
|
-
console.log('>> SUBSCRIBE FAIL:', e);
|
|
1770
|
-
});
|
|
1771
1744
|
|
|
1772
1745
|
}
|
|
1773
1746
|
|
|
@@ -8333,6 +8306,7 @@ class Remote extends RemoteCore {
|
|
|
8333
8306
|
|
|
8334
8307
|
// node.js server side remote.
|
|
8335
8308
|
send(message, isBinary) {
|
|
8309
|
+
// console.log(`<-S [${IOMsg[ message[0]]}]`)
|
|
8336
8310
|
this.manager.txBytes += message.byteLength;
|
|
8337
8311
|
this.socket.txCounter++;
|
|
8338
8312
|
if (this.socketType === 'websocket') {
|
|
@@ -318,16 +318,10 @@ export class IOCore extends EventEmitter<string | symbol, any> {
|
|
|
318
318
|
*/
|
|
319
319
|
subscribe(tag: string): void;
|
|
320
320
|
/**
|
|
321
|
-
* Subscribes
|
|
322
|
-
*
|
|
323
|
-
* @returns {Promise<any>}
|
|
324
|
-
* @throws {TypeError} If tag is not a string or exceeds length limit.
|
|
325
|
-
*/
|
|
326
|
-
subscribe_promise(tag: string): Promise<any>;
|
|
327
|
-
/**
|
|
328
|
-
* Subscribes to channels stored in memory (local cache).
|
|
321
|
+
* Subscribes stored channels.
|
|
322
|
+
* called client state become 'ready'
|
|
329
323
|
*/
|
|
330
|
-
|
|
324
|
+
subscribe_channels(): void;
|
|
331
325
|
/**
|
|
332
326
|
* Unsubscribes from a channel or channels.
|
|
333
327
|
* @param {string} [tag=""] - The tag(s) of the channel(s) to unsubscribe from (comma-separated). If empty, unsubscribes from all.
|
package/package.json
CHANGED
package/src/client/IOCore.js
CHANGED
|
@@ -460,7 +460,7 @@ export class IOCore extends EventEmitter {
|
|
|
460
460
|
|
|
461
461
|
// **IMPORTANT** change state before subscribe.
|
|
462
462
|
this.stateChange('ready', 'cid_ready')
|
|
463
|
-
this.
|
|
463
|
+
this.subscribe_channels()
|
|
464
464
|
break;
|
|
465
465
|
|
|
466
466
|
case IOMsg.QUOTA_LEVEL:
|
|
@@ -732,6 +732,7 @@ export class IOCore extends EventEmitter {
|
|
|
732
732
|
console.log('## your maximum signalSize(bytes) is:', this.quota.signalSize)
|
|
733
733
|
return
|
|
734
734
|
}
|
|
735
|
+
// console.log(`C->[${IOMsg[ data[0]]}]`)
|
|
735
736
|
this.socket_send(data);
|
|
736
737
|
}
|
|
737
738
|
|
|
@@ -958,14 +959,6 @@ export class IOCore extends EventEmitter {
|
|
|
958
959
|
subscribe(tag) {
|
|
959
960
|
if (typeof tag !== 'string') throw TypeError('tag should be string.')
|
|
960
961
|
if (tag.length > SIZE_LIMIT.TAG_LEN1) throw TypeError('please check tag string length limit:' + SIZE_LIMIT.TAG_LEN1)
|
|
961
|
-
if (this.state !== STATE.READY) return
|
|
962
|
-
|
|
963
|
-
// subscribe 사용시, 사용 'ready' 이벤트시 메뉴얼 등록되므로 여기에 등록하면 2중 호출된다.
|
|
964
|
-
// 즉, channels 등록은 listen 같은 자동화 구독시만 사용.
|
|
965
|
-
// let tagList = tag.split(',')
|
|
966
|
-
// tagList.forEach(tag => {
|
|
967
|
-
// this.channels.add(tag)
|
|
968
|
-
// })
|
|
969
962
|
|
|
970
963
|
try {
|
|
971
964
|
let tagEncoded = encoder.encode(tag)
|
|
@@ -975,47 +968,27 @@ export class IOCore extends EventEmitter {
|
|
|
975
968
|
MBP.NB('8', tagEncoded.byteLength),
|
|
976
969
|
tagEncoded]))
|
|
977
970
|
} catch (error) { }
|
|
971
|
+
|
|
978
972
|
}
|
|
979
973
|
|
|
974
|
+
|
|
980
975
|
/**
|
|
981
|
-
* Subscribes
|
|
982
|
-
*
|
|
983
|
-
* @returns {Promise<any>}
|
|
984
|
-
* @throws {TypeError} If tag is not a string or exceeds length limit.
|
|
976
|
+
* Subscribes stored channels.
|
|
977
|
+
* called client state become 'ready'
|
|
985
978
|
*/
|
|
986
|
-
|
|
987
|
-
if (
|
|
988
|
-
if (
|
|
989
|
-
|
|
990
|
-
if (this.state !== STATE.READY) {
|
|
991
|
-
return Promise.reject('subscribe_promise:: connection is not ready')
|
|
992
|
-
}
|
|
979
|
+
subscribe_channels() {
|
|
980
|
+
if (this.state !== STATE.READY) return
|
|
981
|
+
if (this.channels.size == 0) return
|
|
982
|
+
let tag = Array.from(this.channels).join(',')
|
|
993
983
|
|
|
994
984
|
try {
|
|
995
985
|
let tagEncoded = encoder.encode(tag)
|
|
996
986
|
this.send_enc_mode(
|
|
997
987
|
Buffer.concat([
|
|
998
|
-
MBP.NB('8', IOMsg.
|
|
999
|
-
MBP.NB('
|
|
1000
|
-
MBP.NB('16', tagEncoded.byteLength),
|
|
988
|
+
MBP.NB('8', IOMsg.SUBSCRIBE),
|
|
989
|
+
MBP.NB('8', tagEncoded.byteLength),
|
|
1001
990
|
tagEncoded]))
|
|
1002
|
-
return this.setMsgPromise(this.mid)
|
|
1003
991
|
} catch (error) { }
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
/**
|
|
1007
|
-
* Subscribes to channels stored in memory (local cache).
|
|
1008
|
-
*/
|
|
1009
|
-
subscribe_memory_channels() { //local cache . auto_resubscribe
|
|
1010
|
-
if (this.channels.size == 0) return
|
|
1011
|
-
let chList = Array.from(this.channels).join(',')
|
|
1012
|
-
|
|
1013
|
-
this.subscribe_promise(chList)
|
|
1014
|
-
.then((res) => {
|
|
1015
|
-
// console.log('>> SUBSCRIBE_REQ result', res ) // return code == map.size
|
|
1016
|
-
}).catch((e) => {
|
|
1017
|
-
console.log('>> SUBSCRIBE FAIL:', e)
|
|
1018
|
-
})
|
|
1019
992
|
|
|
1020
993
|
}
|
|
1021
994
|
|
package/src/server/Remote.js
CHANGED
|
@@ -187,6 +187,7 @@ export class Remote extends RemoteCore {
|
|
|
187
187
|
|
|
188
188
|
// node.js server side remote.
|
|
189
189
|
send(message, isBinary) {
|
|
190
|
+
// console.log(`<-S [${IOMsg[ message[0]]}]`)
|
|
190
191
|
this.manager.txBytes += message.byteLength;
|
|
191
192
|
this.socket.txCounter++;
|
|
192
193
|
if (this.socketType === 'websocket') {
|