iosignal 1.7.0 → 1.7.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 (49) hide show
  1. package/README.md +254 -247
  2. package/auth_file.json +13 -13
  3. package/auth_file.mjs +23 -23
  4. package/dist/iosignal.esm.js.map +1 -1
  5. package/dist/iosignal.min.js.map +1 -1
  6. package/index.js +19 -19
  7. package/indexWebBrowser.js +13 -13
  8. package/package.json +60 -59
  9. package/rollup.config.js +69 -69
  10. package/src/api/RedisAPI.js +65 -65
  11. package/src/api/api_constant.js +7 -7
  12. package/src/api/api_reply.js +31 -31
  13. package/src/api/api_sudo.js +91 -91
  14. package/src/auth/Auth_Env.js +76 -76
  15. package/src/auth/Auth_File.js +71 -71
  16. package/src/auth/Auth_Redis.js +44 -44
  17. package/src/auth/BohoAuth.js +164 -164
  18. package/src/client/CongPacket.js +141 -141
  19. package/src/client/IOCongSocket.js +81 -81
  20. package/src/client/IOCore.js +822 -822
  21. package/src/client/IOWS.js +80 -80
  22. package/src/client/IOWebSocket.js +111 -111
  23. package/src/common/constants.js +148 -148
  24. package/src/common/payload.js +81 -81
  25. package/src/common/quotaTable.js +68 -68
  26. package/src/common/util.js +61 -61
  27. package/src/server/FileLogger.js +30 -30
  28. package/src/server/Manager.js +433 -433
  29. package/src/server/Metric.js +155 -155
  30. package/src/server/Remote.js +207 -207
  31. package/src/server/RemoteCore.js +439 -439
  32. package/src/server/Server.js +163 -163
  33. package/src/server/serverOption.js +56 -56
  34. package/test-browser/favicon.ico +0 -0
  35. package/test-browser/index.html +96 -96
  36. package/test-browser/server.js +11 -11
  37. package/test-client-nodejs/client.cjs +17 -17
  38. package/test-client-nodejs/client.mjs +17 -17
  39. package/test-client-nodejs/client_api_reply.mjs +15 -15
  40. package/test-client-nodejs/stateChange.mjs +19 -19
  41. package/test-server/server-Auth_Env.js +19 -19
  42. package/test-server/server-Auth_File.js +12 -12
  43. package/test-server/server-api_reply.js +6 -6
  44. package/test-server/server-api_sudo.js +7 -7
  45. package/test-server/server-commonjs.cjs +8 -8
  46. package/test-server/server-esm.mjs +20 -20
  47. package/test-server/simple-server.mjs +11 -11
  48. package/test-signal-payloadType/signalPack.js +34 -34
  49. package/test-signal-payloadType/signaling.js +60 -60
@@ -1,81 +1,81 @@
1
- import { IOCore } from "./IOCore.js"
2
- import { pack, CongRx } from './CongPacket.js'
3
- import net from 'net'
4
-
5
-
6
- export class IOCongSocket extends IOCore {
7
- constructor(url) {
8
- super(url);
9
- if (url) this.open();
10
- }
11
-
12
- close() {
13
- this.socket?.end();
14
- this.socket = null;
15
- }
16
-
17
- stop() {
18
- this.close()
19
- clearInterval(this.connectionCheckerIntervalID);
20
- this.connectionCheckerIntervalID = null
21
- }
22
-
23
- keepAlive() {
24
- let state = this.socket?.readyState;
25
- if (!this.socket || !(state === 'open' || state === 'opening')) {
26
- this.open();
27
- }
28
- }
29
-
30
-
31
- createConnection(url) {
32
- // TCP Socket
33
- let urlObj = new URL(url)
34
- if (urlObj.protocol != "cong:") {
35
- urlObj = new URL('cong://' + url)
36
- }
37
- this.socket = net.createConnection(urlObj.port, urlObj.hostname)
38
- this.stateChange('opening')
39
-
40
- this.socket.on('connect', () => {
41
- this.congRx = new CongRx();
42
- this.socket.pipe(this.congRx)
43
- this.congRx.on("data", this.onTCPSocketMessage.bind(this));
44
- this.emit('open')
45
- })
46
-
47
- this.socket.on('error', e => {
48
- this.emit('error', e)
49
- })
50
-
51
- this.socket.on('close', () => {
52
- this.emit('close');
53
- })
54
-
55
- }
56
-
57
- onTCPSocketMessage(data) {
58
- this.rxCounter++;
59
- this.rxBytes += data.byteLength
60
- this.lastTxRxTime = Date.now();
61
- this.emit('socket_data', data);
62
-
63
- }
64
-
65
- socket_send(data) {
66
- if (this.socket?.readyState === 'open') {
67
- let packData = pack(data);
68
- this.socket.write(packData)
69
- this.txCounter++;
70
- this.txBytes += packData.byteLength;
71
- this.lastTxRxTime = Date.now();
72
- } else {
73
- console.log('.')
74
- }
75
- }
76
-
77
- }
78
-
79
-
80
-
81
-
1
+ import { IOCore } from "./IOCore.js"
2
+ import { pack, CongRx } from './CongPacket.js'
3
+ import net from 'net'
4
+
5
+
6
+ export class IOCongSocket extends IOCore {
7
+ constructor(url) {
8
+ super(url);
9
+ if (url) this.open();
10
+ }
11
+
12
+ close() {
13
+ this.socket?.end();
14
+ this.socket = null;
15
+ }
16
+
17
+ stop() {
18
+ this.close()
19
+ clearInterval(this.connectionCheckerIntervalID);
20
+ this.connectionCheckerIntervalID = null
21
+ }
22
+
23
+ keepAlive() {
24
+ let state = this.socket?.readyState;
25
+ if (!this.socket || !(state === 'open' || state === 'opening')) {
26
+ this.open();
27
+ }
28
+ }
29
+
30
+
31
+ createConnection(url) {
32
+ // TCP Socket
33
+ let urlObj = new URL(url)
34
+ if (urlObj.protocol != "cong:") {
35
+ urlObj = new URL('cong://' + url)
36
+ }
37
+ this.socket = net.createConnection(urlObj.port, urlObj.hostname)
38
+ this.stateChange('opening')
39
+
40
+ this.socket.on('connect', () => {
41
+ this.congRx = new CongRx();
42
+ this.socket.pipe(this.congRx)
43
+ this.congRx.on("data", this.onTCPSocketMessage.bind(this));
44
+ this.emit('open')
45
+ })
46
+
47
+ this.socket.on('error', e => {
48
+ this.emit('error', e)
49
+ })
50
+
51
+ this.socket.on('close', () => {
52
+ this.emit('close');
53
+ })
54
+
55
+ }
56
+
57
+ onTCPSocketMessage(data) {
58
+ this.rxCounter++;
59
+ this.rxBytes += data.byteLength
60
+ this.lastTxRxTime = Date.now();
61
+ this.emit('socket_data', data);
62
+
63
+ }
64
+
65
+ socket_send(data) {
66
+ if (this.socket?.readyState === 'open') {
67
+ let packData = pack(data);
68
+ this.socket.write(packData)
69
+ this.txCounter++;
70
+ this.txBytes += packData.byteLength;
71
+ this.lastTxRxTime = Date.now();
72
+ } else {
73
+ console.log('.')
74
+ }
75
+ }
76
+
77
+ }
78
+
79
+
80
+
81
+