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
package/index.js CHANGED
@@ -1,19 +1,19 @@
1
- export { IOCongSocket } from './src/client/IOCongSocket.js'
2
- export { IOWS as IO } from './src/client/IOWS.js'
3
- export { pack, CongRx } from './src/client/CongPacket.js'
4
- export { Server } from './src/server/Server.js'
5
- export { serverOption } from './src/server/serverOption.js'
6
- export { FileLogger } from './src/server/FileLogger.js'
7
- export * from './src/common/constants.js'
8
-
9
- // boho auth
10
- export * from 'boho'
11
- export { BohoAuth } from './src/auth/BohoAuth.js'
12
- export { Auth_File } from './src/auth/Auth_File.js'
13
- export { Auth_Env } from './src/auth/Auth_Env.js'
14
- export { Auth_Redis } from './src/auth/Auth_Redis.js'
15
-
16
- // api
17
- export * as api_reply from './src/api/api_reply.js'
18
- export * as api_sudo from './src/api/api_sudo.js'
19
- export { RedisAPI } from './src/api/RedisAPI.js'
1
+ export { IOCongSocket } from './src/client/IOCongSocket.js'
2
+ export { IOWS as IO } from './src/client/IOWS.js'
3
+ export { pack, CongRx } from './src/client/CongPacket.js'
4
+ export { Server } from './src/server/Server.js'
5
+ export { serverOption } from './src/server/serverOption.js'
6
+ export { FileLogger } from './src/server/FileLogger.js'
7
+ export * from './src/common/constants.js'
8
+
9
+ // boho auth
10
+ export * from 'boho'
11
+ export { BohoAuth } from './src/auth/BohoAuth.js'
12
+ export { Auth_File } from './src/auth/Auth_File.js'
13
+ export { Auth_Env } from './src/auth/Auth_Env.js'
14
+ export { Auth_Redis } from './src/auth/Auth_Redis.js'
15
+
16
+ // api
17
+ export * as api_reply from './src/api/api_reply.js'
18
+ export * as api_sudo from './src/api/api_sudo.js'
19
+ export { RedisAPI } from './src/api/RedisAPI.js'
@@ -1,13 +1,13 @@
1
- import { IO } from './src/client/IOWebSocket.js'
2
- import { Boho, RAND, MBP, BohoMsg, Meta, MetaSize, sha256, Buffer } from 'boho'
3
-
4
- Boho.RAND = RAND;
5
- Boho.BohoMsg = BohoMsg;
6
- Boho.Meta = Meta;
7
- Boho.MetaSize = MetaSize;
8
- Boho.sha256 = sha256;
9
- IO.Boho = Boho;
10
- IO.MBP = MBP;
11
- IO.Buffer = Buffer;
12
-
13
- export default IO;
1
+ import { IO } from './src/client/IOWebSocket.js'
2
+ import { Boho, RAND, MBP, BohoMsg, Meta, MetaSize, sha256, Buffer } from 'boho'
3
+
4
+ Boho.RAND = RAND;
5
+ Boho.BohoMsg = BohoMsg;
6
+ Boho.Meta = Meta;
7
+ Boho.MetaSize = MetaSize;
8
+ Boho.sha256 = sha256;
9
+ IO.Boho = Boho;
10
+ IO.MBP = MBP;
11
+ IO.Buffer = Buffer;
12
+
13
+ export default IO;
package/package.json CHANGED
@@ -1,59 +1,60 @@
1
- {
2
- "name": "iosignal",
3
- "version": "1.7.0",
4
- "description": "iosignal",
5
- "type": "module",
6
- "main": "./dist/iosignal.cjs",
7
- "exports": {
8
- "import": "./index.js",
9
- "require": "./dist/iosignal.cjs"
10
- },
11
- "browser": "./dist/iosignal.min.js",
12
- "browser_esm": "./dist/iosignal.esm.js",
13
- "esm": "./dist/iosignal.mjs",
14
- "devDependencies": {
15
- "@rollup/plugin-commonjs": "^17.1.0",
16
- "@rollup/plugin-json": "^6.0.1",
17
- "@rollup/plugin-node-resolve": "^11.2.1",
18
- "@rollup/plugin-replace": "^4.0.0",
19
- "@rollup/plugin-terser": "^0.4.4",
20
- "mocha": "^9.2.2",
21
- "redis": "^4.6.12",
22
- "rollup": "^2.79.1"
23
- },
24
- "scripts": {
25
- "build": "rollup -c",
26
- "start": "node ./test-browser/server.js"
27
- },
28
- "engines": {
29
- "node": ">=15.0.0"
30
- },
31
- "author": {
32
- "name": "Lee Dongeun",
33
- "email": "sixgen@gmail.com"
34
- },
35
- "license": "MIT",
36
- "dependencies": {
37
- "boho": "^0.8.2",
38
- "eventemitter3": "^5.0.1",
39
- "meta-buffer-pack": "^1.4.0",
40
- "ws": "^8.17.1"
41
- },
42
- "optionalDependencies": {
43
- "bufferutil": "^4.0.8",
44
- "utf-8-validate": "^6.0.3"
45
- },
46
- "repository": {
47
- "type": "git",
48
- "url": "git://github.com/remocons/iosignal.git"
49
- },
50
- "homepage": "https://iosignal.net",
51
- "keywords": [
52
- "websocket",
53
- "pubsub",
54
- "arduino",
55
- "iot",
56
- "auth",
57
- "signal"
58
- ]
59
- }
1
+ {
2
+ "name": "iosignal",
3
+ "version": "1.7.1",
4
+ "description": "iosignal",
5
+ "type": "module",
6
+ "main": "./dist/iosignal.cjs",
7
+ "exports": {
8
+ "import": "./index.js",
9
+ "require": "./dist/iosignal.cjs"
10
+ },
11
+ "browser": "./dist/iosignal.min.js",
12
+ "browser_esm": "./dist/iosignal.esm.js",
13
+ "esm": "./dist/iosignal.mjs",
14
+ "devDependencies": {
15
+ "@rollup/plugin-commonjs": "^17.1.0",
16
+ "@rollup/plugin-json": "^6.0.1",
17
+ "@rollup/plugin-node-resolve": "^11.2.1",
18
+ "@rollup/plugin-replace": "^4.0.0",
19
+ "@rollup/plugin-terser": "^0.4.4",
20
+ "mocha": "^9.2.2",
21
+ "redis": "^4.6.12",
22
+ "rollup": "^2.79.1"
23
+ },
24
+ "scripts": {
25
+ "build": "rollup -c",
26
+ "start": "node ./test-browser/server.js"
27
+ },
28
+ "engines": {
29
+ "node": ">=15.0.0"
30
+ },
31
+ "author": {
32
+ "name": "Taeo Lee",
33
+ "email": "taeo.mocha@gmail.com"
34
+ },
35
+ "license": "MIT",
36
+ "dependencies": {
37
+ "boho": "^0.8.2",
38
+ "commander": "^12.1.0",
39
+ "eventemitter3": "^5.0.1",
40
+ "meta-buffer-pack": "^1.4.0",
41
+ "ws": "^8.17.1"
42
+ },
43
+ "optionalDependencies": {
44
+ "bufferutil": "^4.0.8",
45
+ "utf-8-validate": "^6.0.3"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git://github.com/remocons/iosignal.git"
50
+ },
51
+ "homepage": "https://iosignal.net",
52
+ "keywords": [
53
+ "websocket",
54
+ "pubsub",
55
+ "arduino",
56
+ "iot",
57
+ "auth",
58
+ "signal"
59
+ ]
60
+ }
package/rollup.config.js CHANGED
@@ -1,69 +1,69 @@
1
- import replace from '@rollup/plugin-replace'
2
- import resolve from '@rollup/plugin-node-resolve'
3
- import commonjs from '@rollup/plugin-commonjs'
4
- import terser from '@rollup/plugin-terser'
5
- import json from '@rollup/plugin-json'
6
- import pkg from './package.json'
7
-
8
- export default [
9
- {
10
- input: './indexWebBrowser.js',
11
- output: [
12
- {
13
- file: pkg.browser,
14
- format: 'iife',
15
- name: 'IO',
16
- sourcemap: true,
17
- }
18
-
19
- ],
20
- plugins: [
21
- replace({
22
- crypto: '',
23
- delimiters: ['import { webcrypto } from \'', '\''],
24
- preventAssignment: true
25
- }),
26
- resolve(),
27
- commonjs()
28
- ,terser()
29
- ]
30
- }
31
- ,{
32
- input: './src/client/IOWebSocket.js',
33
- output: [
34
- {
35
- file: pkg.browser_esm,
36
- format: 'es', //
37
- sourcemap: true,
38
- }
39
- ],
40
- plugins: [
41
- replace({
42
- crypto: '',
43
- delimiters: ['import { webcrypto } from \'', '\''],
44
- preventAssignment: true
45
- }),
46
- resolve(),
47
- commonjs()
48
- ,terser()
49
- ]
50
- }
51
-
52
- ,{
53
- input: './index.js',
54
- output: [
55
- { file: pkg.main,
56
- format: 'cjs'
57
- }
58
- ],
59
- plugins: [
60
- resolve({
61
- preferBuiltins: true
62
- }),
63
- json(),
64
- commonjs()
65
- ,terser()
66
- ]
67
- }
68
-
69
- ]
1
+ import replace from '@rollup/plugin-replace'
2
+ import resolve from '@rollup/plugin-node-resolve'
3
+ import commonjs from '@rollup/plugin-commonjs'
4
+ import terser from '@rollup/plugin-terser'
5
+ import json from '@rollup/plugin-json'
6
+ import pkg from './package.json'
7
+
8
+ export default [
9
+ {
10
+ input: './indexWebBrowser.js',
11
+ output: [
12
+ {
13
+ file: pkg.browser,
14
+ format: 'iife',
15
+ name: 'IO',
16
+ sourcemap: true,
17
+ }
18
+
19
+ ],
20
+ plugins: [
21
+ replace({
22
+ crypto: '',
23
+ delimiters: ['import { webcrypto } from \'', '\''],
24
+ preventAssignment: true
25
+ }),
26
+ resolve(),
27
+ commonjs()
28
+ ,terser()
29
+ ]
30
+ }
31
+ ,{
32
+ input: './src/client/IOWebSocket.js',
33
+ output: [
34
+ {
35
+ file: pkg.browser_esm,
36
+ format: 'es', //
37
+ sourcemap: true,
38
+ }
39
+ ],
40
+ plugins: [
41
+ replace({
42
+ crypto: '',
43
+ delimiters: ['import { webcrypto } from \'', '\''],
44
+ preventAssignment: true
45
+ }),
46
+ resolve(),
47
+ commonjs()
48
+ ,terser()
49
+ ]
50
+ }
51
+
52
+ ,{
53
+ input: './index.js',
54
+ output: [
55
+ { file: pkg.main,
56
+ format: 'cjs'
57
+ }
58
+ ],
59
+ plugins: [
60
+ resolve({
61
+ preferBuiltins: true
62
+ }),
63
+ json(),
64
+ commonjs()
65
+ ,terser()
66
+ ]
67
+ }
68
+
69
+ ]
@@ -1,65 +1,65 @@
1
- import { STATUS } from './api_constant.js'
2
-
3
- const MIN_LEVEL = 200;
4
- const COMMANDS = [
5
- 'GET', 'SET',
6
- 'HGETALL', 'HGET',
7
- 'HSET', 'SADD',
8
- 'SISMEMBER', 'SMEMBERS',
9
- 'EXISTS', 'SREM',
10
- 'DEL', 'KEYS',
11
- 'SAVE'
12
- ]
13
-
14
- export class RedisAPI {
15
- constructor(redisClient, _minLevel) {
16
- if (!redisClient) {
17
- throw new Error("RedisAPI constructor: no redisClient")
18
- }
19
- this.redisClient = redisClient
20
- this.minLevel = _minLevel ? _minLevel : MIN_LEVEL
21
- this.commands = COMMANDS
22
- }
23
-
24
-
25
- checkPermission(remote, req) {
26
- console.log('checkPermission', remote.level, 'vs', this.minLevel)
27
- if (remote.level >= this.minLevel) {
28
- return true
29
- } else {
30
- return false
31
- }
32
- }
33
-
34
-
35
- async request(remote, req) {
36
-
37
- let result;
38
- let status = STATUS.OK;
39
- try {
40
- let cmd = req.topic
41
- cmd = cmd.toUpperCase()
42
- if (COMMANDS.includes(cmd)) {
43
- console.log('RedisAPI call:', cmd, req.args)
44
-
45
- if (req.args.length > 0) {
46
- result = await this.redisClient[cmd](...req.args)
47
- } else {
48
- result = await this.redisClient[cmd]()
49
- }
50
-
51
-
52
- } else {
53
- status = STATUS.ERROR;
54
- }
55
- remote.response(req.mid, status, result)
56
- } catch (e) {
57
- remote.response(req.mid, STATUS.ERROR, e.message)
58
- }
59
-
60
- }
61
-
62
- }
63
-
64
-
65
-
1
+ import { STATUS } from './api_constant.js'
2
+
3
+ const MIN_LEVEL = 200;
4
+ const COMMANDS = [
5
+ 'GET', 'SET',
6
+ 'HGETALL', 'HGET',
7
+ 'HSET', 'SADD',
8
+ 'SISMEMBER', 'SMEMBERS',
9
+ 'EXISTS', 'SREM',
10
+ 'DEL', 'KEYS',
11
+ 'SAVE'
12
+ ]
13
+
14
+ export class RedisAPI {
15
+ constructor(redisClient, _minLevel) {
16
+ if (!redisClient) {
17
+ throw new Error("RedisAPI constructor: no redisClient")
18
+ }
19
+ this.redisClient = redisClient
20
+ this.minLevel = _minLevel ? _minLevel : MIN_LEVEL
21
+ this.commands = COMMANDS
22
+ }
23
+
24
+
25
+ checkPermission(remote, req) {
26
+ console.log('checkPermission', remote.level, 'vs', this.minLevel)
27
+ if (remote.level >= this.minLevel) {
28
+ return true
29
+ } else {
30
+ return false
31
+ }
32
+ }
33
+
34
+
35
+ async request(remote, req) {
36
+
37
+ let result;
38
+ let status = STATUS.OK;
39
+ try {
40
+ let cmd = req.topic
41
+ cmd = cmd.toUpperCase()
42
+ if (COMMANDS.includes(cmd)) {
43
+ console.log('RedisAPI call:', cmd, req.args)
44
+
45
+ if (req.args.length > 0) {
46
+ result = await this.redisClient[cmd](...req.args)
47
+ } else {
48
+ result = await this.redisClient[cmd]()
49
+ }
50
+
51
+
52
+ } else {
53
+ status = STATUS.ERROR;
54
+ }
55
+ remote.response(req.mid, status, result)
56
+ } catch (e) {
57
+ remote.response(req.mid, STATUS.ERROR, e.message)
58
+ }
59
+
60
+ }
61
+
62
+ }
63
+
64
+
65
+
@@ -1,7 +1,7 @@
1
-
2
- export const STATUS = {
3
- OK: 0,
4
- //0~127: success
5
- //128~255: fail
6
- ERROR: 255
7
- }
1
+
2
+ export const STATUS = {
3
+ OK: 0,
4
+ //0~127: success
5
+ //128~255: fail
6
+ ERROR: 255
7
+ }
@@ -1,31 +1,31 @@
1
-
2
-
3
- import { STATUS } from './api_constant.js'
4
-
5
- const MIN_LEVEL = 0;
6
-
7
- export function checkPermission(remote) {
8
- if (remote.level >= MIN_LEVEL) {
9
- return true
10
- } else {
11
- return false
12
- }
13
- }
14
-
15
- export async function echo(remote, req) {
16
- if (!req.args)
17
- remote.response(req.mid, STATUS.ERROR, 'no message to echo')
18
- else
19
- remote.response(req.mid, STATUS.OK, req.args)
20
- }
21
-
22
- export async function date(remote, req) {
23
- let r = new Date().toUTCString()
24
- remote.response(req.mid, STATUS.OK, r)
25
- }
26
-
27
- export async function unixtime(remote, req) {
28
- let r = Math.floor(Date.now() / 1000)
29
- remote.response(req.mid, STATUS.OK, r)
30
- }
31
-
1
+
2
+
3
+ import { STATUS } from './api_constant.js'
4
+
5
+ const MIN_LEVEL = 0;
6
+
7
+ export function checkPermission(remote) {
8
+ if (remote.level >= MIN_LEVEL) {
9
+ return true
10
+ } else {
11
+ return false
12
+ }
13
+ }
14
+
15
+ export async function echo(remote, req) {
16
+ if (!req.args)
17
+ remote.response(req.mid, STATUS.ERROR, 'no message to echo')
18
+ else
19
+ remote.response(req.mid, STATUS.OK, req.args)
20
+ }
21
+
22
+ export async function date(remote, req) {
23
+ let r = new Date().toUTCString()
24
+ remote.response(req.mid, STATUS.OK, r)
25
+ }
26
+
27
+ export async function unixtime(remote, req) {
28
+ let r = Math.floor(Date.now() / 1000)
29
+ remote.response(req.mid, STATUS.OK, r)
30
+ }
31
+