iosignal 1.8.0 → 2.1.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 (39) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +47 -52
  3. package/dist/iosignal.cjs +25 -1
  4. package/dist/iosignal.js +19 -4
  5. package/dist/iosignal.js.map +1 -1
  6. package/dist/iosignal.min.js +26 -0
  7. package/dist/iosignal.min.js.map +1 -0
  8. package/dist/iosignal.mjs +25 -0
  9. package/index.js +7 -2
  10. package/package.json +16 -14
  11. package/rollup.config.js +16 -41
  12. package/src/auth/Auth_Env.js +2 -2
  13. package/src/auth/Auth_File.js +2 -2
  14. package/src/auth/Auth_Redis.js +2 -2
  15. package/src/auth/BohoAuth.js +5 -5
  16. package/src/client/CongPacket.js +1 -1
  17. package/src/client/IOCore.js +12 -11
  18. package/src/client/IOWebSocket.js +11 -4
  19. package/src/common/payload.js +1 -1
  20. package/src/server/Manager.js +1 -1
  21. package/src/server/RemoteCore.js +12 -13
  22. package/test-browser/index.html +11 -13
  23. package/test-browser/server.js +2 -1
  24. package/{test-client-nodejs → test-nodejs}/client.cjs +2 -2
  25. package/{test-client-nodejs → test-nodejs}/client.mjs +2 -2
  26. package/{test-client-nodejs → test-nodejs}/client_api_reply.mjs +2 -2
  27. package/{test-server → test-nodejs}/server-Auth_Env.js +1 -1
  28. package/{test-server → test-nodejs}/server-Auth_File.js +1 -1
  29. package/{test-server → test-nodejs}/server-esm.mjs +1 -1
  30. package/{test-signal-payloadType → test-nodejs}/signaling.js +3 -3
  31. package/{test-server → test-nodejs}/simple-server.mjs +2 -1
  32. package/dist/iosignal-iife.js +0 -11
  33. package/dist/iosignal-iife.js.map +0 -1
  34. package/indexWebBrowser.js +0 -13
  35. package/test-client-nodejs/stateChange.mjs +0 -19
  36. /package/{test-server → test-nodejs}/server-api_reply.js +0 -0
  37. /package/{test-server → test-nodejs}/server-api_sudo.js +0 -0
  38. /package/{test-server → test-nodejs}/server-commonjs.cjs +0 -0
  39. /package/{test-signal-payloadType → test-nodejs}/signalPack.js +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Taeo Lee <taeo.mocha@gmail.com>
3
+ Copyright (c) 2022 Lee Taeo <taeo.mocha@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -6,33 +6,22 @@ The signaling protocol is built-in, so the server can be used without programmin
6
6
  [Kr] iosignal 은 웹브라우저, node.js , arduino 간의 실시간 통신을 지원합니다. 또한 보안 인증과 암호통신 기능도 제공됩니다.
7
7
  시그널링 프로토콜이 내장되어 있어서 서버는 프로그래밍 없이 사용 가능합니다.
8
8
 
9
- ## online demo
10
-
11
- ### StackBlitz Webcontainer demo
12
-
13
- [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/~/github.com/remocons/iosignal-example)
14
-
15
-
16
9
  ## Install
17
10
 
18
- ```
11
+ ```shell
19
12
  $ npm i iosignal
20
13
  ```
21
14
 
22
15
  ## IOSignal Server
23
16
 
24
- CommonJS and ESM support both
25
-
26
- ### ESM style
27
-
28
- ```
17
+ ### ESM
18
+ ```js
29
19
  import { Server } from "iosignal"
30
20
  const server = new Server( { port: 7777 } )
31
21
  ```
32
22
 
33
- ### CJS style
34
-
35
- ```
23
+ ### CJS
24
+ ```js
36
25
  let { Server } = require('iosignal')
37
26
  const server = new Server( { port: 7777 } )
38
27
  ```
@@ -48,7 +37,7 @@ const server = new Server(
48
37
  port: 7777,
49
38
  congPort: 8888,
50
39
  showMetric: 2,
51
- showMessage: 'message' // show raw signal buffer
40
+ showMessage: 'message' // show signal message
52
41
  })
53
42
 
54
43
  ```
@@ -59,7 +48,7 @@ const server = new Server(
59
48
  - showMessage: "none"|"message" show signal buffer message
60
49
  - timeout <milliseconds> ping period & timeout (min. 1000)
61
50
 
62
- ### IOSiognal API
51
+ ### IOSignal API
63
52
 
64
53
  IOSignal API examples
65
54
  - src/api_reply.js // 'echo', 'date', 'unixtime'
@@ -72,6 +61,7 @@ To register an API service with the server, use the api() method
72
61
  `api('api_name', module )`
73
62
 
74
63
  ```js
64
+ // node.js
75
65
  import { Server ,api_reply } from 'iosignal'
76
66
  const server = new Server( { port: 7777 } )
77
67
  server.api('reply', api_reply) // attach api module
@@ -80,19 +70,21 @@ server.api('reply', api_reply) // attach api module
80
70
  Example of a client calling the reply API
81
71
 
82
72
  ```js
83
- import { IO } from "iosignal"
84
- const io = new IO('ws://localhost:7777')
85
-
86
- io.on('ready', async ()=>{
87
- let res_echo = await io.req('reply', 'echo', 'hello' )
88
- let res_date = await io.req('reply', 'date' )
89
- let res_unixtime = await io.req('reply', 'unixtime' )
73
+ // web browser api client example
74
+ <script src="../dist/iosignal.min.js"></script>
75
+ <script>
76
+ const io = new IO('ws://localhost:7777')
90
77
 
91
- if( res_echo.ok ) console.log( res_echo.body )
92
- if( res_date.ok ) console.log( res_date.body )
93
- if( res_unixtime.ok ) console.log( res_unixtime.body )
78
+ io.on('ready', async ()=>{
79
+ let res_echo = await io.req('reply', 'echo', 'hello' )
80
+ let res_date = await io.req('reply', 'date' )
81
+ let res_unixtime = await io.req('reply', 'unixtime' )
94
82
 
95
- });
83
+ if( res_echo.ok ) console.log( res_echo.body )
84
+ if( res_date.ok ) console.log( res_date.body )
85
+ if( res_unixtime.ok ) console.log( res_unixtime.body )
86
+ });
87
+ </script>
96
88
 
97
89
  // result
98
90
  [ 'hello' ]
@@ -105,37 +97,36 @@ Fri, 09 Feb 2024 14:24:37 GMT
105
97
  ## IOSignal Client
106
98
 
107
99
  ### NodeJS Client
108
- ```
109
- // ESM
110
- import { IO } from "iosignal"
100
+ ```js
101
+ // ESM
102
+ import { IOWS } from "iosignal"
111
103
 
112
- // CJS
113
- // const { IO } = require('iosignal')
104
+ // CJS
105
+ // const { IOWS } = require('iosignal')
114
106
 
115
- const io = new IO('wss://io.iosignal.net/ws')
107
+ const io = new IOWS('wss://io.iosignal.net/ws')
116
108
 
117
- io.on('ready', ()=>{
118
- console.log('ready cid:', io.cid)
119
- io.signal('#screen','playToggle')
120
- });
109
+ io.on('ready', ()=>{
110
+ console.log('ready cid:', io.cid)
111
+ io.signal('#screen','playToggle')
112
+ });
121
113
 
122
- io.listen('#notify', (...args)=>{
123
- console.log( args )
124
- })
114
+ io.listen('#notify', (...args)=>{
115
+ console.log( args )
116
+ })
125
117
 
126
- io.on('error',err=>{
127
- console.log('err', err)
128
- })
118
+ io.on('error',err=>{
119
+ console.log('err', err)
120
+ })
129
121
 
130
122
  ```
131
123
 
132
- ### Browser Client : IIFE
133
-
124
+ ### Browser Client : UMD(IIFE)
125
+ - local file: "./dist/iosignal.min.js"
126
+ - CDN: https://cdn.jsdelivr.net/npm/iosignal@2.1.0/dist/iosignal.min.js
134
127
  ```html
135
128
  <html>
136
-
137
- <script src="../dist/iosignal-iife.js"></script>
138
-
129
+ <script src="../dist/iosignal.min.js"></script>
139
130
  <script>
140
131
  console.log('IO', IO) // default global variable name is IO
141
132
 
@@ -185,13 +176,17 @@ io.on('error',err=>{
185
176
  ```
186
177
 
187
178
  ### Browser client : ESM
179
+
180
+ - local file: "./dist/iosignal.js"
181
+ - CDN: https://cdn.jsdelivr.net/npm/iosignal@2.1.0/dist/iosignal.js
182
+
188
183
  ```html
189
184
  <html>
190
185
 
191
186
  <script type="module">
192
- import { IO, Boho, MBP, Buffer } from "../dist/iosignal.js"
187
+ import IO from "../dist/iosignal.js"
193
188
 
194
- const = io = new IO('wss://io.iosignal.net/ws')
189
+ const io = new IO('wss://io.iosignal.net/ws')
195
190
  io.listen('channel#topic', (...args)={
196
191
  console.log( args )
197
192
  })