iosignal 1.7.0 → 1.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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +254 -247
  3. package/auth_file.json +13 -13
  4. package/auth_file.mjs +23 -23
  5. package/dist/iosignal-iife.js +11 -0
  6. package/dist/iosignal-iife.js.map +1 -0
  7. package/dist/iosignal.cjs +1 -2
  8. package/dist/iosignal.js +11 -0
  9. package/dist/iosignal.js.map +1 -0
  10. package/index.js +19 -19
  11. package/indexWebBrowser.js +13 -13
  12. package/package.json +56 -59
  13. package/rollup.config.js +72 -69
  14. package/src/api/RedisAPI.js +65 -65
  15. package/src/api/api_constant.js +7 -7
  16. package/src/api/api_reply.js +31 -31
  17. package/src/api/api_sudo.js +91 -91
  18. package/src/auth/Auth_Env.js +76 -76
  19. package/src/auth/Auth_File.js +71 -71
  20. package/src/auth/Auth_Redis.js +44 -44
  21. package/src/auth/BohoAuth.js +164 -164
  22. package/src/client/CongPacket.js +141 -141
  23. package/src/client/IOCongSocket.js +81 -81
  24. package/src/client/IOCore.js +822 -822
  25. package/src/client/IOWS.js +80 -80
  26. package/src/client/IOWebSocket.js +111 -111
  27. package/src/common/constants.js +148 -148
  28. package/src/common/payload.js +81 -81
  29. package/src/common/quotaTable.js +68 -68
  30. package/src/common/util.js +61 -61
  31. package/src/server/FileLogger.js +30 -30
  32. package/src/server/Manager.js +433 -433
  33. package/src/server/Metric.js +155 -155
  34. package/src/server/Remote.js +207 -207
  35. package/src/server/RemoteCore.js +439 -439
  36. package/src/server/Server.js +163 -163
  37. package/src/server/serverOption.js +56 -56
  38. package/test-browser/favicon.ico +0 -0
  39. package/test-browser/index.html +96 -96
  40. package/test-browser/server.js +11 -11
  41. package/test-client-nodejs/client.cjs +17 -17
  42. package/test-client-nodejs/client.mjs +17 -17
  43. package/test-client-nodejs/client_api_reply.mjs +15 -15
  44. package/test-client-nodejs/stateChange.mjs +19 -19
  45. package/test-server/server-Auth_Env.js +19 -19
  46. package/test-server/server-Auth_File.js +12 -12
  47. package/test-server/server-api_reply.js +6 -6
  48. package/test-server/server-api_sudo.js +7 -7
  49. package/test-server/server-commonjs.cjs +8 -8
  50. package/test-server/server-esm.mjs +20 -20
  51. package/test-server/simple-server.mjs +11 -11
  52. package/test-signal-payloadType/signalPack.js +34 -34
  53. package/test-signal-payloadType/signaling.js +60 -60
  54. package/dist/iosignal.esm.js +0 -3
  55. package/dist/iosignal.esm.js.map +0 -1
  56. package/dist/iosignal.min.js +0 -3
  57. package/dist/iosignal.min.js.map +0 -1
@@ -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
+