iosignal 2.2.1 → 3.0.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 +109 -118
- package/dist/io.js +3 -4
- package/dist/io.js.map +1 -1
- package/dist/io.min.js +3 -4
- package/dist/io.min.js.map +1 -1
- package/dist/iosignal.js +9118 -0
- package/docs/README.kr.md +230 -0
- package/docs/iosignal_architecture.png +0 -0
- package/package.json +16 -10
- package/rollup.config.js +2 -4
- package/src/auth/Auth_File.js +1 -1
- package/src/client/{IOWebSocket.js → browser/IOWebSocket.js} +3 -3
- package/test-nodejs/server-Auth_File.js +1 -1
- package/dist/iosignal.cjs +0 -23
- package/dist/iosignal.mjs +0 -23
- package/img/iosignal_stack.png +0 -0
- package/test-nodejs/client.cjs +0 -17
- package/test-nodejs/server-commonjs.cjs +0 -9
- /package/{auth_file.mjs → auth_file.js} +0 -0
- /package/test-nodejs/{client.mjs → client.js} +0 -0
- /package/test-nodejs/{client_api_reply.mjs → client_api_reply.js} +0 -0
- /package/test-nodejs/{server-esm.mjs → server.js} +0 -0
- /package/test-nodejs/{simple-server.mjs → simple-server.js} +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
[ en | [kr](docs/README.kr.md) ]
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
The signaling protocol is built-in, so the server can be used without programming.
|
|
3
|
+
# IOSignal
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
시그널링 프로토콜이 내장되어 있어서 서버는 프로그래밍 없이 사용 가능합니다.
|
|
5
|
+
IOSignal enables real-time communication across web browsers, Node.js, and Arduino. It features built-in secure authentication, encrypted communication, and a pre-configured signaling protocol, allowing server deployment without complex programming.
|
|
8
6
|
|
|
9
7
|
## Install
|
|
10
8
|
|
|
@@ -12,118 +10,40 @@ The signaling protocol is built-in, so the server can be used without programmin
|
|
|
12
10
|
$ npm i iosignal
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
## IOSignal Server
|
|
16
|
-
|
|
17
|
-
### ESM
|
|
18
|
-
```js
|
|
19
|
-
import { Server } from "iosignal"
|
|
20
|
-
const server = new Server( { port: 7777 } )
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### CJS
|
|
24
|
-
```js
|
|
25
|
-
let { Server } = require('iosignal')
|
|
26
|
-
const server = new Server( { port: 7777 } )
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### server options
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
let { Server } = require('iosignal')
|
|
34
|
-
|
|
35
|
-
const server = new Server(
|
|
36
|
-
{
|
|
37
|
-
port: 7777,
|
|
38
|
-
congPort: 8888,
|
|
39
|
-
showMetric: 2,
|
|
40
|
-
showMessage: 'message' // show signal message
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
- port: <Number> IOSignal over WebSocket
|
|
46
|
-
- congPort: <Number> IOsignal over CongSocket
|
|
47
|
-
- showMetric: 1|2|3 show clients cid(state) info
|
|
48
|
-
- showMessage: "none"|"message" show signal buffer message
|
|
49
|
-
- timeout <milliseconds> ping period & timeout (min. 1000)
|
|
50
13
|
|
|
51
|
-
### IOSignal API
|
|
52
|
-
|
|
53
|
-
IOSignal API examples
|
|
54
|
-
- src/api_reply.js // 'echo', 'date', 'unixtime'
|
|
55
|
-
- src/api_sudo.js // server admin monitoring command
|
|
56
|
-
- src/RedisAPI.js // redis command and response service
|
|
57
14
|
|
|
15
|
+
## IOSignal Client
|
|
58
16
|
|
|
59
|
-
|
|
17
|
+
### Browser client : ESM
|
|
60
18
|
|
|
61
|
-
|
|
19
|
+
- local file: "dist/io.js"
|
|
20
|
+
- CDN: https://cdn.jsdelivr.net/npm/iosignal/dist/io.js
|
|
62
21
|
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
import { Server ,api_reply } from 'iosignal'
|
|
66
|
-
const server = new Server( { port: 7777 } )
|
|
67
|
-
server.api('reply', api_reply) // attach api module
|
|
68
|
-
```
|
|
22
|
+
```html
|
|
23
|
+
<html>
|
|
69
24
|
|
|
70
|
-
|
|
25
|
+
<script type="module">
|
|
26
|
+
import IO from "../dist/io.js"
|
|
71
27
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const io = new IO('ws://localhost:7777')
|
|
28
|
+
const io = new IO('wss://io.iosignal.net/ws')
|
|
29
|
+
io.listen('channel#topic', (...args)={
|
|
30
|
+
console.log( args )
|
|
31
|
+
})
|
|
77
32
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
let res_unixtime = await io.req('reply', 'unixtime' )
|
|
33
|
+
io.on('ready',()=>{
|
|
34
|
+
console.log('ready cid:', io.cid )
|
|
35
|
+
})
|
|
82
36
|
|
|
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
37
|
</script>
|
|
88
38
|
|
|
89
|
-
|
|
90
|
-
[ 'hello' ]
|
|
91
|
-
Fri, 09 Feb 2024 14:24:37 GMT
|
|
92
|
-
1707488677
|
|
93
|
-
|
|
39
|
+
</html>
|
|
94
40
|
```
|
|
95
41
|
|
|
96
42
|
|
|
97
|
-
## IOSignal Client
|
|
98
|
-
|
|
99
|
-
### NodeJS Client
|
|
100
|
-
```js
|
|
101
|
-
// ESM
|
|
102
|
-
import { IO } from "iosignal"
|
|
103
|
-
|
|
104
|
-
// CJS
|
|
105
|
-
// const { IO } = require('iosignal')
|
|
106
|
-
|
|
107
|
-
const io = new IO('wss://io.iosignal.net/ws')
|
|
108
|
-
|
|
109
|
-
io.on('ready', ()=>{
|
|
110
|
-
console.log('ready cid:', io.cid)
|
|
111
|
-
io.signal('#screen','playToggle')
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
io.listen('#notify', (...args)=>{
|
|
115
|
-
console.log( args )
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
io.on('error',err=>{
|
|
119
|
-
console.log('err', err)
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
|
|
124
43
|
### Browser Client : UMD(IIFE)
|
|
125
|
-
- local file: "
|
|
126
|
-
- CDN: https://cdn.jsdelivr.net/npm/iosignal
|
|
44
|
+
- local file: "dist/io.min.js"
|
|
45
|
+
- CDN: https://cdn.jsdelivr.net/npm/iosignal/dist/io.min.js
|
|
46
|
+
|
|
127
47
|
```html
|
|
128
48
|
<html>
|
|
129
49
|
<script src="../dist/io.min.js"></script>
|
|
@@ -175,31 +95,101 @@ Fri, 09 Feb 2024 14:24:37 GMT
|
|
|
175
95
|
</html>
|
|
176
96
|
```
|
|
177
97
|
|
|
178
|
-
### Browser client : ESM
|
|
179
98
|
|
|
180
|
-
- local file: "./dist/io.js"
|
|
181
|
-
- CDN: https://cdn.jsdelivr.net/npm/iosignal@2.2.0/dist/io.js
|
|
182
99
|
|
|
183
|
-
```html
|
|
184
|
-
<html>
|
|
185
100
|
|
|
186
|
-
|
|
187
|
-
|
|
101
|
+
### NodeJS Client
|
|
102
|
+
```js
|
|
103
|
+
import { IO } from "iosignal"
|
|
188
104
|
|
|
189
|
-
|
|
190
|
-
io.listen('channel#topic', (...args)={
|
|
191
|
-
console.log( args )
|
|
192
|
-
})
|
|
105
|
+
const io = new IO('wss://io.iosignal.net/ws')
|
|
193
106
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
107
|
+
io.on('ready', ()=>{
|
|
108
|
+
console.log('ready cid:', io.cid)
|
|
109
|
+
io.signal('#screen','playToggle')
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
io.listen('#notify', (...args)=>{
|
|
113
|
+
console.log( args )
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
io.on('error',err=>{
|
|
117
|
+
console.log('err', err)
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
## IOSignal Server
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
import { Server } from "iosignal"
|
|
130
|
+
|
|
131
|
+
const server = new Server(
|
|
132
|
+
{
|
|
133
|
+
port: 7777,
|
|
134
|
+
congPort: 8888,
|
|
135
|
+
showMetric: 2,
|
|
136
|
+
showMessage: 'message' // show signal message
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
- port: <Number> IOSignal over WebSocket
|
|
142
|
+
- congPort: <Number> IOsignal over CongSocket
|
|
143
|
+
- showMetric: 1|2|3 show clients cid(state) info
|
|
144
|
+
- showMessage: "none"|"message" show signal buffer message
|
|
145
|
+
- timeout <milliseconds> ping period & timeout (min. 1000)
|
|
146
|
+
|
|
147
|
+
### IOSignal API
|
|
148
|
+
|
|
149
|
+
IOSignal API examples
|
|
150
|
+
- src/api_reply.js // 'echo', 'date', 'unixtime'
|
|
151
|
+
- src/api_sudo.js // server admin monitoring command
|
|
152
|
+
- src/RedisAPI.js // redis command and response service
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
To register an API service with the server, use the api() method
|
|
156
|
+
|
|
157
|
+
`api('api_name', module )`
|
|
158
|
+
|
|
159
|
+
```js
|
|
160
|
+
// node.js
|
|
161
|
+
import { Server ,api_reply } from 'iosignal'
|
|
162
|
+
const server = new Server( { port: 7777 } )
|
|
163
|
+
server.api('reply', api_reply) // attach api module
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Example of a client calling the reply API
|
|
197
167
|
|
|
168
|
+
```js
|
|
169
|
+
// web browser api client example
|
|
170
|
+
<script src="../dist/io.min.js"></script>
|
|
171
|
+
<script>
|
|
172
|
+
const io = new IO('ws://localhost:7777')
|
|
173
|
+
|
|
174
|
+
io.on('ready', async ()=>{
|
|
175
|
+
let res_echo = await io.req('reply', 'echo', 'hello' )
|
|
176
|
+
let res_date = await io.req('reply', 'date' )
|
|
177
|
+
let res_unixtime = await io.req('reply', 'unixtime' )
|
|
178
|
+
|
|
179
|
+
if( res_echo.ok ) console.log( res_echo.body )
|
|
180
|
+
if( res_date.ok ) console.log( res_date.body )
|
|
181
|
+
if( res_unixtime.ok ) console.log( res_unixtime.body )
|
|
182
|
+
});
|
|
198
183
|
</script>
|
|
199
184
|
|
|
200
|
-
|
|
185
|
+
// result
|
|
186
|
+
[ 'hello' ]
|
|
187
|
+
Fri, 09 Feb 2024 14:24:37 GMT
|
|
188
|
+
1707488677
|
|
189
|
+
|
|
201
190
|
```
|
|
202
191
|
|
|
192
|
+
|
|
203
193
|
## Features
|
|
204
194
|
|
|
205
195
|
### Built-in Message Trasport Protocol
|
|
@@ -220,7 +210,8 @@ Fri, 09 Feb 2024 14:24:37 GMT
|
|
|
220
210
|
- Node.js use WebSocket or CongSocket.
|
|
221
211
|
- Arduino use CongSocket.
|
|
222
212
|
|
|
223
|
-
|
|
213
|
+
## IOSignal Server Architecture
|
|
214
|
+

|
|
224
215
|
|
|
225
216
|
## IOSignal repositories.
|
|
226
217
|
|