iosignal-cli 2.2.0 → 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/LICENSE +1 -1
- package/README.ko.md +400 -0
- package/README.md +91 -87
- package/img/iosignal_architecture.png +0 -0
- package/package.json +6 -5
- /package/{auth_file.mjs → auth_file.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Taeo Lee <sixgen@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.ko.md
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
# IOSignal CLI
|
|
2
|
+
[ 한국어 | [English](README.md) ]
|
|
3
|
+
|
|
4
|
+
IOSignal은 웹 브라우저, Node.js 애플리케이션 및 Arduino 장치 간의 실시간 통신을 용이하게 합니다. 또한 안전한 인증 및 암호화된 통신을 제공합니다. 내장된 시그널링 프로토콜을 통해 서버는 추가 프로그래밍 없이 사용할 수 있습니다.
|
|
5
|
+
|
|
6
|
+
`iosignal-cli` 프로그램은 IOSignal 서버 및 클라이언트의 작동을 단순화합니다. [iosignal](https://www.npmjs.com/package/iosignal) 라이브러리를 활용하고 인증 데이터베이스 기능에 Redis를 사용합니다.
|
|
7
|
+
|
|
8
|
+
## 지원 플랫폼
|
|
9
|
+
|
|
10
|
+
Windows, macOS, Linux.
|
|
11
|
+
|
|
12
|
+
## 설치
|
|
13
|
+
|
|
14
|
+
### Linux, macOS 및 쉘
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
# 전역 설치.
|
|
18
|
+
$ npm install -g iosignal-cli
|
|
19
|
+
|
|
20
|
+
# 권한 오류가 발생하면 sudo를 사용하십시오.
|
|
21
|
+
$ sudo npm install -g iosignal-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Windows (관리자 권한)
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
# 전역 설치.
|
|
28
|
+
$ npm install -g iosignal-cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## IOSignal 서버
|
|
32
|
+
|
|
33
|
+
- `io-server` 명령을 사용합니다.
|
|
34
|
+
- `ios`는 `io-server`의 약어입니다.
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
% io-server -h
|
|
38
|
+
Usage: io-server [options] (--listen <port> )
|
|
39
|
+
|
|
40
|
+
Options:
|
|
41
|
+
-V, --version output the version number
|
|
42
|
+
-l, --listen <port> listen on port (start WebSocket Server)
|
|
43
|
+
-L, --listen-congport <port> listen on cong port (start CongSocket
|
|
44
|
+
Server)
|
|
45
|
+
-d, --auth-file <path> auth data file path
|
|
46
|
+
-e, --auth-param <id.key.level> auth data from argument:
|
|
47
|
+
id.key.level,id2.key2.level2
|
|
48
|
+
-E, --auth-env auth data from shell env BOHO_AUTH
|
|
49
|
+
-r, --auth-redis connect to redis. if exist use env
|
|
50
|
+
REDIS_HOST, REDIS_PORT or localhost:6379
|
|
51
|
+
-t, --timeout <milliseconds> ping period & timeout
|
|
52
|
+
-m, --metric <type> show metric <number> 1:traffic, 2:echo
|
|
53
|
+
-s, --show-message <none|message> show receive message.
|
|
54
|
+
-f, --file-logger write log files.
|
|
55
|
+
-a, --api-list [list...] one or multiple api names: -a api_1 api_2
|
|
56
|
+
-o, --show-options show server init options.
|
|
57
|
+
-h, --help display help for command
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### WebSocket을 통한 IOSignal
|
|
62
|
+
|
|
63
|
+
- `-l` 옵션을 사용하여 WebSocket 연결을 위한 포트 번호를 지정합니다.
|
|
64
|
+
- 웹 브라우저 및 Node.js 클라이언트 액세스를 지원합니다.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
% io-server -l 7777
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### CongSocket을 통한 IOSignal
|
|
71
|
+
|
|
72
|
+
- `-L` 옵션을 사용하여 CongSocket 연결을 위한 포트 번호를 지정합니다.
|
|
73
|
+
- CongSocket은 WebSocket보다 가볍게 설계된 IOSignal의 자체 프로토콜입니다.
|
|
74
|
+
- Arduino와 같은 저사양 장치를 위해 특별히 개발되었습니다.
|
|
75
|
+
- Arduino 및 Node.js 클라이언트 액세스를 지원합니다.
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
% io-server -L 8888
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### WebSocket 및 CongSocket 동시 지원
|
|
82
|
+
|
|
83
|
+
- 이를 통해 Arduino와 웹 브라우저가 서로 통신할 수 있습니다.
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
% io-server -l 7777 -L 8888
|
|
87
|
+
opening WebSocket Server: 7777
|
|
88
|
+
opening CongSocket Server: 8888
|
|
89
|
+
|
|
90
|
+
┌───────────────────────────────────────────┐
|
|
91
|
+
│ │
|
|
92
|
+
│ Serving │
|
|
93
|
+
│ │
|
|
94
|
+
│ IOSignal Over WebSocket │
|
|
95
|
+
│ │
|
|
96
|
+
│ Web Browser & Node.js │
|
|
97
|
+
│ - Local: ws://localhost:7777 │
|
|
98
|
+
│ - Network: ws://192.168.0.72:7777 │
|
|
99
|
+
│ │
|
|
100
|
+
│ IOSignal Over CongSocket │
|
|
101
|
+
│ │
|
|
102
|
+
│ Node.js │
|
|
103
|
+
│ - Local: cong://localhost:8888 │
|
|
104
|
+
│ - Network: cong://192.168.0.72:8888 │
|
|
105
|
+
│ │
|
|
106
|
+
│ Arduino │
|
|
107
|
+
│ - host: 192.168.0.72 │
|
|
108
|
+
│ - port: 8888 │
|
|
109
|
+
│ │
|
|
110
|
+
└───────────────────────────────────────────┘
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 모니터 서버
|
|
117
|
+
|
|
118
|
+
### 수신 메시지 보기
|
|
119
|
+
|
|
120
|
+
- 서버에서 수신되는 시그널 메시지를 보려면 `-s` 옵션을 사용합니다.
|
|
121
|
+
- `ios`는 `io-server`의 약어입니다.
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
% ios -l 7777 -s message
|
|
125
|
+
...
|
|
126
|
+
|
|
127
|
+
#1(undefined) [ CID_REQ ] <Buffer c1>
|
|
128
|
+
#1(?ayTp) [ SIGNAL ] <Buffer d0 02 68 69 00>
|
|
129
|
+
#1(?ayTp) [ PING ] <Buffer cd>
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 메트릭 보기
|
|
134
|
+
|
|
135
|
+
- `-m 1`: 채널, 클라이언트 및 트래픽을 표시합니다.
|
|
136
|
+
- `-m 2`: 클라이언트를 표시합니다.
|
|
137
|
+
- `-m 3`: 채널을 표시합니다.
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
|
|
141
|
+
$ ios -l 7777 -m 1
|
|
142
|
+
...
|
|
143
|
+
|
|
144
|
+
monitor metric type: 1
|
|
145
|
+
┌─────────┬───────────┬───────────┬──────────┬──────────┬──────────────┐
|
|
146
|
+
│ (index) │ rss │ heapTotal │ heapUsed │ external │ arrayBuffers │
|
|
147
|
+
├─────────┼───────────┼───────────┼──────────┼──────────┼──────────────┤
|
|
148
|
+
│ 0 │ 108232704 │ 57294848 │ 24523112 │ 1389925 │ 59260 │
|
|
149
|
+
└─────────┴───────────┴───────────┴──────────┴──────────┴──────────────┘
|
|
150
|
+
┌─────────┬──────────┬─────────┬──────────┬─────────┬─────────┐
|
|
151
|
+
│ (index) │ lastSSID │ remotes │ channels │ txBytes │ rxBytes │
|
|
152
|
+
├─────────┼──────────┼─────────┼──────────┼─────────┼─────────┤
|
|
153
|
+
│ 0 │ 2 │ 2 │ 1 │ 57 │ 18 │
|
|
154
|
+
└─────────┴──────────┴─────────┴──────────┴─────────┴─────────┘
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
$ ios -l 7777 -m 2
|
|
158
|
+
...
|
|
159
|
+
monitor metric type: 2
|
|
160
|
+
┌─────────┬───────────────┐
|
|
161
|
+
│ (index) │ Values │
|
|
162
|
+
├─────────┼───────────────┤
|
|
163
|
+
│ 0 │ '#1:?9P-i(7)' │
|
|
164
|
+
│ 1 │ '#2:?zNuW(7)' │
|
|
165
|
+
└─────────┴───────────────┘
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
$ ios -l 7777 -m 3
|
|
169
|
+
...
|
|
170
|
+
monitor metric type: 3
|
|
171
|
+
┌─────────┬───────────────────────┐
|
|
172
|
+
│ (index) │ Values │
|
|
173
|
+
├─────────┼───────────────────────┤
|
|
174
|
+
│ 0 │ 'PRIVATE:#homeButton' │
|
|
175
|
+
└─────────┴───────────────────────┘
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## IOSignal 클라이언트
|
|
179
|
+
|
|
180
|
+
- `io-client` 명령을 사용합니다.
|
|
181
|
+
- `io`는 `io-client`의 약어입니다.
|
|
182
|
+
|
|
183
|
+
### 사용법
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
% io -h
|
|
187
|
+
Usage: io [options] (--connect <url> )
|
|
188
|
+
|
|
189
|
+
Options:
|
|
190
|
+
-V, --version output the version number
|
|
191
|
+
-t, --timeout <milliseconds> ping period & timeout
|
|
192
|
+
-c, --connect <url> connect to a server
|
|
193
|
+
-i, --id <id> userId
|
|
194
|
+
-k, --key <key> userKey
|
|
195
|
+
-a, --auth-idKey <idkey> auth id.key
|
|
196
|
+
-j, --join-channel <channelName> join to channel
|
|
197
|
+
-h, --help display help for command
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 연결
|
|
202
|
+
|
|
203
|
+
- 서버에 연결하려면 `-c` 옵션을 사용하여 서버 주소와 포트 번호를 지정합니다.
|
|
204
|
+
- 서버 주소는 다음 프로토콜 중 하나를 필요로 합니다: `ws`, `wss`, 또는 `cong`.
|
|
205
|
+
- `ws://url:port` (WebSocket)
|
|
206
|
+
- `localhost`의 경우 `ws://`는 생략할 수 있습니다.
|
|
207
|
+
- `wss://url:port` (WebSocket TLS)
|
|
208
|
+
- `cong://url:port` (CongSocket)
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
% io -c ws://localhost:7777
|
|
212
|
+
{ connect: 'ws://localhost:7777' }
|
|
213
|
+
Connecting to ws://localhost:7777
|
|
214
|
+
ready: cid: ?cybL
|
|
215
|
+
>
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
```sh
|
|
220
|
+
% io -c cong://localhost:8888
|
|
221
|
+
{ connect: 'cong://localhost:8888' }
|
|
222
|
+
Connecting to cong://localhost:8888
|
|
223
|
+
ready: cid: ?yVAQ
|
|
224
|
+
>
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
- 클라이언트 연결에 성공하면 `cid` (통신 ID)가 `ready` 표시와 함께 표시됩니다.
|
|
229
|
+
- CID는 서버에서 발급하는 고유한 통신 ID입니다.
|
|
230
|
+
- 인증되지 않은 클라이언트의 CID는 연결할 때마다 변경됩니다.
|
|
231
|
+
- 인증된 클라이언트는 고정된 사전 정의된 CID를 사용합니다.
|
|
232
|
+
- CID를 사용하여 일대일 통신 또는 CID 구독을 할 수 있습니다.
|
|
233
|
+
|
|
234
|
+
### `io-client` CLI 명령 목록
|
|
235
|
+
|
|
236
|
+
- `io-client` CLI 프로그램을 사용하여 서버에 연결하면 아래 명령을 사용하여 통신하고, 구독하고, 시그널을 발행할 수 있습니다.
|
|
237
|
+
- CLI 프로그램은 서버에 연결된 브라우저 및 Arduino 장치와도 통신할 수 있습니다.
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
io-client cli commands:
|
|
241
|
+
.sig
|
|
242
|
+
.signal .publish .pub is the same as .sig.
|
|
243
|
+
.sub
|
|
244
|
+
.subscribe is the same as .sub.
|
|
245
|
+
.listen : subscirbe and print the received messages to the screen.
|
|
246
|
+
.unsub
|
|
247
|
+
.ping
|
|
248
|
+
.pong
|
|
249
|
+
.id
|
|
250
|
+
.iam
|
|
251
|
+
.open
|
|
252
|
+
.connect
|
|
253
|
+
.close
|
|
254
|
+
.login
|
|
255
|
+
.auth
|
|
256
|
+
.quit
|
|
257
|
+
.exit
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## 튜토리얼
|
|
261
|
+
|
|
262
|
+
### 시그널링
|
|
263
|
+
|
|
264
|
+
- **멀티캐스트**: 채널 이름을 구독/발행합니다.
|
|
265
|
+
- **유니캐스트**: CID (통신 ID)를 사용합니다.
|
|
266
|
+
|
|
267
|
+
1. 서버 시작:
|
|
268
|
+
```sh
|
|
269
|
+
$ io-server -l 7777
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
2. 클라이언트 A 시작:
|
|
274
|
+
|
|
275
|
+
```sh
|
|
276
|
+
$ io -c localhost:7777
|
|
277
|
+
Connecting to ws://localhost:7777
|
|
278
|
+
ready: cid: ?c3Nr
|
|
279
|
+
|
|
280
|
+
> .subscribe channel_name
|
|
281
|
+
# 채널 구독
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
3. 클라이언트 B 시작:
|
|
285
|
+
```sh
|
|
286
|
+
$ io -c localhost:7777
|
|
287
|
+
Connecting to ws://localhost:7777
|
|
288
|
+
ready: cid: ?rr75
|
|
289
|
+
>
|
|
290
|
+
# 멀티캐스트.
|
|
291
|
+
> .signal channel_name some_message
|
|
292
|
+
|
|
293
|
+
# A에게 유니캐스트.
|
|
294
|
+
> .signal ?c3Nr@ direct_message
|
|
295
|
+
# 중요: 유니캐스트 시그널 태그에는 '@' 문자가 포함되어야 합니다 (예: tag = 'cid' + @).
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### 인증
|
|
299
|
+
|
|
300
|
+
#### 유형 1: 파일에서 인증 데이터
|
|
301
|
+
|
|
302
|
+
- 개인 용도로만 사용합니다.
|
|
303
|
+
- 원시, 일반 비밀번호 문자열 (해시되지 않음).
|
|
304
|
+
- 각 장치에는 `deviceId`, `deviceKey`, `deviceCId`, `level`의 네 가지 값이 있습니다.
|
|
305
|
+
- 루트 폴더에서 샘플 `auth_file.js` 및 `auth_file.json`을 찾을 수 있습니다.
|
|
306
|
+
```sh
|
|
307
|
+
$ io-server -l 7777 -d auth_file.json
|
|
308
|
+
or
|
|
309
|
+
$ io-server -l 7777 -d auth_file.js
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
`auth_file.json` 구조:
|
|
313
|
+
- `deviceId` 문자열 길이 제한: 8자.
|
|
314
|
+
- 비밀번호 문자열 길이 제한 없음 (SHA256으로 32바이트로 다이제스트됨).
|
|
315
|
+
- `CID` 문자열 길이 제한: 현재 20자 (변경 가능).
|
|
316
|
+
- JSON 파일은 주석을 지원하지 않습니다.
|
|
317
|
+
```js
|
|
318
|
+
[
|
|
319
|
+
["id","key","cid",0],
|
|
320
|
+
["did2","did2key","did2-cid",0],
|
|
321
|
+
["uno3","uno3-key","uno3-cid",1]
|
|
322
|
+
]
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### `auth_file.js`
|
|
326
|
+
|
|
327
|
+
- 주석을 지원합니다.
|
|
328
|
+
|
|
329
|
+
```js
|
|
330
|
+
// *.mjs file support comments.
|
|
331
|
+
export const authInfo = [
|
|
332
|
+
// device id, key, communication id, level:Number(0~255)
|
|
333
|
+
["did","passowrd","cid",0],
|
|
334
|
+
["device1","device1_key","device1_cid",0],
|
|
335
|
+
["root","root-key","root-cid",255], // default admin_root level is 255
|
|
336
|
+
["uno","uno-key","uno",1]
|
|
337
|
+
]
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
#### 유형 2: Redis (또는 기타 데이터베이스)에서 인증 데이터
|
|
341
|
+
|
|
342
|
+
- 권장됩니다.
|
|
343
|
+
- 소스 코드 및 예제는 다음에서 찾을 수 있습니다:
|
|
344
|
+
- `iosignal`: `/src/auth/`
|
|
345
|
+
- `iosignal-cli`: `/test_auth_redis/`
|
|
346
|
+
|
|
347
|
+
서버를 실행하기 전에 Redis 서버가 작동 중이고 장치 자격 증명을 등록했는지 확인하십시오. 간단한 자격 증명 등록 예제는 위 소스에 포함되어 있습니다.
|
|
348
|
+
|
|
349
|
+
로컬 Redis 인증 시스템으로 서버 시작
|
|
350
|
+
```sh
|
|
351
|
+
$ io-server -l 7777 -r # redis://localhost:6379
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### 클라이언트 인증
|
|
355
|
+
1. 인증 서버를 시작합니다.
|
|
356
|
+
2. 연결하고 로그인합니다.
|
|
357
|
+
|
|
358
|
+
```sh
|
|
359
|
+
$ io -c localhost:7777
|
|
360
|
+
ready: cid: ?YXDr
|
|
361
|
+
> .login uno3 uno3-key
|
|
362
|
+
try manual login: uno3
|
|
363
|
+
> >> QUOTA_LEVEL : 1
|
|
364
|
+
current quota: {"signalSize":255,"publishCounter":10,"trafficRate":100000}
|
|
365
|
+
ready: cid: uno3-cid
|
|
366
|
+
|
|
367
|
+
- 이제 장치에 (사전 등록된) CID가 있습니다.
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## 웹 브라우저 및 Arduino 동시 지원
|
|
372
|
+
|
|
373
|
+
### 두 가지 유형의 포트 지정
|
|
374
|
+
|
|
375
|
+
IOSignal은 웹 브라우저 피어 연결에 WebSocket을 사용합니다. Arduino 연결을 사용하려면 `-L` 옵션을 사용하여 CongSocket 포트를 지정해야 합니다.
|
|
376
|
+
|
|
377
|
+
`-l` 옵션은 WebSocket 포트를 지정하고, `-L` 옵션은 Arduino 연결을 위한 CongSocket 포트를 지정합니다.
|
|
378
|
+
|
|
379
|
+
```sh
|
|
380
|
+
|
|
381
|
+
$ io-server -l 7777 -L 8888
|
|
382
|
+
# -l 옵션은 WebSocket 포트용
|
|
383
|
+
# -L 옵션은 CongSocket 포트용 (Arduino 연결)
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### 로컬 네트워크 IP 주소
|
|
387
|
+
|
|
388
|
+
로컬 네트워크에서 서버에 액세스하기 위해 서버의 IP 주소가 필요한 경우 다음 명령을 사용하여 확인할 수 있습니다:
|
|
389
|
+
|
|
390
|
+
```sh
|
|
391
|
+
$ ioip
|
|
392
|
+
192.168.0.72
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### IOSignal Arduino 라이브러리
|
|
396
|
+
|
|
397
|
+
Arduino 라이브러리 관리자에서 `IOSignal`을 검색하여 설치하거나, [`iosignal-arduino`](https://github.com/remocons/iosignal-arduino) GitHub 저장소를 참조하십시오.
|
|
398
|
+
|
|
399
|
+
## iosignal 스택
|
|
400
|
+

|
package/README.md
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
# IOSignal CLI
|
|
1
|
+
# IOSignal CLI
|
|
2
|
+
[ [한국어](README.ko.md) | English ]
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
IOSignal facilitates real-time communication among web browsers, Node.js applications, and Arduino devices. It also offers secure authentication and encrypted communication. With its built-in signaling protocol, the server can be used without additional programming.
|
|
4
5
|
|
|
5
|
-
iosignal-cli program
|
|
6
|
+
The `iosignal-cli` program simplifies the operation of an IOSignal server and client. It leverages the [iosignal](https://www.npmjs.com/package/iosignal) library and utilizes Redis for authentication database functionality.
|
|
6
7
|
|
|
7
|
-
[Kr] iosignal 은 웹브라우저, node.js , arduino 간의 실시간 통신을 지원합니다. 또한 보안 인증과 암호통신 기능도 제공됩니다. 시그널링 프로토콜이 내장되어 있어서 서버는 프로그래밍 없이 사용 가능합니다.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Supported Platforms
|
|
10
10
|
|
|
11
|
-
Windows,
|
|
11
|
+
Windows, macOS, and Linux.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Installation
|
|
14
14
|
|
|
15
|
-
Linux,
|
|
15
|
+
### Linux, macOS, and Shell
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
#
|
|
18
|
+
# Global installation.
|
|
19
19
|
$ npm install -g iosignal-cli
|
|
20
20
|
|
|
21
21
|
# If you encounter a permissions error, use sudo.
|
|
22
22
|
$ sudo npm install -g iosignal-cli
|
|
23
23
|
```
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
### Windows (with Administrator Permissions)
|
|
26
|
+
|
|
25
27
|
```sh
|
|
26
|
-
#
|
|
28
|
+
# Global installation.
|
|
27
29
|
$ npm install -g iosignal-cli
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
## IOSignal
|
|
32
|
+
## IOSignal Server
|
|
31
33
|
|
|
32
|
-
-
|
|
33
|
-
- `ios` is a
|
|
34
|
+
- Use the `io-server` command.
|
|
35
|
+
- `ios` is a shorthand alias for `io-server`.
|
|
34
36
|
|
|
35
37
|
```
|
|
36
38
|
% io-server -h
|
|
@@ -59,9 +61,8 @@ Options:
|
|
|
59
61
|
|
|
60
62
|
### IOSignal over WebSocket
|
|
61
63
|
|
|
62
|
-
- Use the
|
|
63
|
-
|
|
64
|
-
- Supports web browser and node.js client access.
|
|
64
|
+
- Use the `-l` option to specify the port number for WebSocket connections.
|
|
65
|
+
- Supports web browser and Node.js client access.
|
|
65
66
|
|
|
66
67
|
```sh
|
|
67
68
|
% io-server -l 7777
|
|
@@ -69,18 +70,18 @@ Options:
|
|
|
69
70
|
|
|
70
71
|
### IOSignal Over CongSocket
|
|
71
72
|
|
|
72
|
-
- Use the
|
|
73
|
-
- CongSocket is IOSignal's
|
|
73
|
+
- Use the `-L` option to specify the port number for CongSocket connections.
|
|
74
|
+
- CongSocket is IOSignal's proprietary protocol, designed to be lighter than WebSocket.
|
|
74
75
|
- It was developed specifically for low-end devices like Arduino.
|
|
75
|
-
- Supports Arduino and
|
|
76
|
+
- Supports Arduino and Node.js client access.
|
|
76
77
|
|
|
77
78
|
```sh
|
|
78
79
|
% io-server -L 8888
|
|
79
80
|
```
|
|
80
81
|
|
|
81
|
-
### WebSocket and CongSocket
|
|
82
|
+
### Simultaneous WebSocket and CongSocket Support
|
|
82
83
|
|
|
83
|
-
- This allows
|
|
84
|
+
- This allows Arduino and web browsers to communicate with each other.
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
```sh
|
|
@@ -116,10 +117,10 @@ opening CongSocket Server: 8888
|
|
|
116
117
|
|
|
117
118
|
## Monitor Server
|
|
118
119
|
|
|
119
|
-
### Viewing
|
|
120
|
+
### Viewing Incoming Messages
|
|
120
121
|
|
|
121
|
-
- To view
|
|
122
|
-
- `ios` is a
|
|
122
|
+
- To view incoming signal messages on the server, use the `-s` option.
|
|
123
|
+
- `ios` is a shorthand alias for `io-server`.
|
|
123
124
|
|
|
124
125
|
```
|
|
125
126
|
% ios -l 7777 -s message
|
|
@@ -131,11 +132,11 @@ opening CongSocket Server: 8888
|
|
|
131
132
|
|
|
132
133
|
```
|
|
133
134
|
|
|
134
|
-
### Viewing
|
|
135
|
+
### Viewing Metrics
|
|
135
136
|
|
|
136
|
-
- `-m 1
|
|
137
|
-
- `-m 2
|
|
138
|
-
- `-m 3
|
|
137
|
+
- `-m 1`: Displays channels, clients, and traffic.
|
|
138
|
+
- `-m 2`: Displays clients.
|
|
139
|
+
- `-m 3`: Displays channels.
|
|
139
140
|
|
|
140
141
|
```sh
|
|
141
142
|
|
|
@@ -176,12 +177,12 @@ monitor metric type: 3
|
|
|
176
177
|
└─────────┴───────────────────────┘
|
|
177
178
|
```
|
|
178
179
|
|
|
179
|
-
##
|
|
180
|
+
## IOSignal Client
|
|
180
181
|
|
|
181
|
-
-
|
|
182
|
-
- `io` is a
|
|
182
|
+
- Use the `io-client` command.
|
|
183
|
+
- `io` is a shorthand alias for `io-client`.
|
|
183
184
|
|
|
184
|
-
###
|
|
185
|
+
### Usage
|
|
185
186
|
|
|
186
187
|
```
|
|
187
188
|
% io -h
|
|
@@ -199,14 +200,14 @@ Options:
|
|
|
199
200
|
|
|
200
201
|
```
|
|
201
202
|
|
|
202
|
-
###
|
|
203
|
-
- To connect to a server, specify the server address and port number with the -c option.
|
|
203
|
+
### Connection
|
|
204
204
|
|
|
205
|
-
-
|
|
206
|
-
- `ws
|
|
207
|
-
-
|
|
208
|
-
- `
|
|
209
|
-
- `
|
|
205
|
+
- To connect to a server, specify the server address and port number using the `-c` option.
|
|
206
|
+
- The server address requires one of the following protocols: `ws`, `wss`, or `cong`.
|
|
207
|
+
- `ws://url:port` (WebSocket)
|
|
208
|
+
- For `localhost`, `ws://` can be omitted.
|
|
209
|
+
- `wss://url:port` (WebSocket TLS)
|
|
210
|
+
- `cong://url:port` (CongSocket)
|
|
210
211
|
|
|
211
212
|
```sh
|
|
212
213
|
% io -c ws://localhost:7777
|
|
@@ -226,17 +227,17 @@ ready: cid: ?yVAQ
|
|
|
226
227
|
|
|
227
228
|
```
|
|
228
229
|
|
|
229
|
-
-
|
|
230
|
+
- Upon successful client connection, the `cid` (Communication ID) is displayed with a `ready` indication.
|
|
230
231
|
- The CID is a unique communication ID issued by the server.
|
|
231
232
|
- The CID of an unauthenticated client changes with each connection.
|
|
232
233
|
- Authenticated clients use a fixed, predefined CID.
|
|
233
234
|
- You can use CIDs for one-to-one communication or CID subscriptions.
|
|
234
235
|
|
|
235
236
|
|
|
236
|
-
### io-client
|
|
237
|
+
### `io-client` CLI Command List
|
|
237
238
|
|
|
238
|
-
- When connected to the server with the io-client CLI program, you can communicate, subscribe, and issue signals
|
|
239
|
-
- The CLI program can also communicate with browsers and Arduino connected to the server.
|
|
239
|
+
- When connected to the server with the `io-client` CLI program, you can communicate, subscribe, and issue signals using the commands below.
|
|
240
|
+
- The CLI program can also communicate with browsers and Arduino devices connected to the server.
|
|
240
241
|
|
|
241
242
|
```
|
|
242
243
|
io-client cli commands:
|
|
@@ -260,20 +261,20 @@ io-client cli commands:
|
|
|
260
261
|
```
|
|
261
262
|
|
|
262
263
|
|
|
263
|
-
##
|
|
264
|
+
## Tutorial
|
|
264
265
|
|
|
265
|
-
###
|
|
266
|
+
### Signaling
|
|
266
267
|
|
|
267
|
-
-
|
|
268
|
-
-
|
|
268
|
+
- **Multicast**: Publish/subscribe to a channel name.
|
|
269
|
+
- **Unicast**: Use a CID (Communication ID).
|
|
269
270
|
|
|
270
|
-
1.
|
|
271
|
+
1. Start the server:
|
|
271
272
|
```sh
|
|
272
273
|
$ io-server -l 7777
|
|
273
274
|
|
|
274
275
|
```
|
|
275
276
|
|
|
276
|
-
2.
|
|
277
|
+
2. Start client A:
|
|
277
278
|
|
|
278
279
|
```sh
|
|
279
280
|
$ io -c localhost:7777
|
|
@@ -281,43 +282,42 @@ Connecting to ws://localhost:7777
|
|
|
281
282
|
ready: cid: ?c3Nr
|
|
282
283
|
|
|
283
284
|
> .subscribe channel_name
|
|
284
|
-
#
|
|
285
|
+
# Subscribe to a channel
|
|
285
286
|
```
|
|
286
287
|
|
|
287
|
-
3.
|
|
288
|
+
3. Start client B:
|
|
288
289
|
```sh
|
|
289
290
|
$ io -c localhost:7777
|
|
290
291
|
Connecting to ws://localhost:7777
|
|
291
292
|
ready: cid: ?rr75
|
|
292
293
|
>
|
|
293
|
-
#
|
|
294
|
+
# Multicast.
|
|
294
295
|
> .signal channel_name some_message
|
|
295
296
|
|
|
296
|
-
#
|
|
297
|
+
# Unicast to A.
|
|
297
298
|
> .signal ?c3Nr@ direct_message
|
|
298
|
-
# IMPORTANT.
|
|
299
|
-
# unicast signal tag must include '@' charactor. tag = 'cid' + @
|
|
299
|
+
# IMPORTANT: Unicast signal tags must include the '@' character (e.g., tag = 'cid' + @).
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
###
|
|
302
|
+
### Authentication
|
|
303
303
|
|
|
304
|
-
####
|
|
304
|
+
#### Type 1: Authentication Data from File
|
|
305
305
|
|
|
306
|
-
-
|
|
307
|
-
-
|
|
308
|
-
-
|
|
309
|
-
-
|
|
306
|
+
- For personal use only.
|
|
307
|
+
- Raw, plain password strings (not hashed).
|
|
308
|
+
- Each device has four values: `deviceId`, `deviceKey`, `deviceCId`, and `level`.
|
|
309
|
+
- You can find sample `auth_file.js` and `auth_file.json` in the root folder.
|
|
310
310
|
```sh
|
|
311
311
|
$ io-server -l 7777 -d auth_file.json
|
|
312
312
|
or
|
|
313
|
-
$ io-server -l 7777 -d auth_file.
|
|
313
|
+
$ io-server -l 7777 -d auth_file.js
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
auth_file.json structure
|
|
317
|
-
- deviceId string size limit: 8
|
|
318
|
-
- No passphrase string limit
|
|
319
|
-
- CID string size limit:
|
|
320
|
-
- JSON
|
|
316
|
+
auth_file.json structure:
|
|
317
|
+
- `deviceId` string size limit: 8 characters.
|
|
318
|
+
- No passphrase string limit (it will be digested to 32 bytes with SHA256).
|
|
319
|
+
- `CID` string size limit: currently 20 characters (can be changed).
|
|
320
|
+
- JSON files do not support comments.
|
|
321
321
|
```js
|
|
322
322
|
[
|
|
323
323
|
["id","key","cid",0],
|
|
@@ -326,8 +326,9 @@ auth_file.json structure
|
|
|
326
326
|
]
|
|
327
327
|
```
|
|
328
328
|
|
|
329
|
-
### auth_file.
|
|
330
|
-
|
|
329
|
+
### `auth_file.js`
|
|
330
|
+
|
|
331
|
+
- Supports comments.
|
|
331
332
|
|
|
332
333
|
```js
|
|
333
334
|
// *.mjs file support comments.
|
|
@@ -342,13 +343,14 @@ export const authInfo = [
|
|
|
342
343
|
|
|
343
344
|
|
|
344
345
|
|
|
345
|
-
####
|
|
346
|
-
- Recommended
|
|
347
|
-
- you can find source and examples here.
|
|
348
|
-
- `iosiganl` "/src/auth/"
|
|
349
|
-
- `iosignal-cli` "/test_auth_redis/"
|
|
346
|
+
#### Type 2: Authentication Data from Redis (or other Database)
|
|
350
347
|
|
|
351
|
-
|
|
348
|
+
- Recommended.
|
|
349
|
+
- You can find source code and examples here:
|
|
350
|
+
- `iosignal`: `/src/auth/`
|
|
351
|
+
- `iosignal-cli`: `/test_auth_redis/`
|
|
352
|
+
|
|
353
|
+
Before running the server, ensure your Redis server is operational and that you have registered your device credentials. A simple credentials enrollment example is included in the source above.
|
|
352
354
|
|
|
353
355
|
start server with local redis-auth-system
|
|
354
356
|
```sh
|
|
@@ -356,9 +358,9 @@ $ io-server -l 7777 -r # redis://localhost:6379
|
|
|
356
358
|
```
|
|
357
359
|
|
|
358
360
|
|
|
359
|
-
|
|
360
|
-
1.
|
|
361
|
-
2.
|
|
361
|
+
### Authenticating Clients
|
|
362
|
+
1. Start the authentication server.
|
|
363
|
+
2. Connect and log in.
|
|
362
364
|
|
|
363
365
|
```sh
|
|
364
366
|
$ io -c localhost:7777
|
|
@@ -369,15 +371,17 @@ try manual login: uno3
|
|
|
369
371
|
current quota: {"signalSize":255,"publishCounter":10,"trafficRate":100000}
|
|
370
372
|
ready: cid: uno3-cid
|
|
371
373
|
|
|
372
|
-
|
|
374
|
+
- Now the device has a (pre-registered) CID.
|
|
373
375
|
|
|
374
376
|
```
|
|
375
377
|
|
|
376
|
-
## Support for
|
|
377
|
-
|
|
378
|
-
|
|
378
|
+
## Support for Both Web Browsers and Arduino
|
|
379
|
+
|
|
380
|
+
### Specifying Two Types of Ports
|
|
381
|
+
|
|
382
|
+
IOSignal uses WebSockets for web browser peer connections. If you want to use an Arduino connection, you must specify the CongSocket port using the `-L` option.
|
|
379
383
|
|
|
380
|
-
The
|
|
384
|
+
The `-l` option specifies the WebSocket port, and the `-L` option specifies the CongSocket port for Arduino connections.
|
|
381
385
|
|
|
382
386
|
```sh
|
|
383
387
|
|
|
@@ -388,7 +392,7 @@ $ io-server -l 7777 -L 8888
|
|
|
388
392
|
|
|
389
393
|
### Local Network IP Address
|
|
390
394
|
|
|
391
|
-
If you need the IP address
|
|
395
|
+
If you need the server's IP address to access it from your local network, you can check it using the following command:
|
|
392
396
|
|
|
393
397
|
```sh
|
|
394
398
|
$ ioip
|
|
@@ -398,8 +402,8 @@ $ ioip
|
|
|
398
402
|
|
|
399
403
|
### IOSignal Arduino Library
|
|
400
404
|
|
|
401
|
-
Search for `IOSignal` in the Arduino library manager and install it, or
|
|
405
|
+
Search for `IOSignal` in the Arduino library manager and install it, or refer to the [`iosignal-arduino`](https://github.com/remocons/iosignal-arduino) GitHub repository.
|
|
402
406
|
|
|
403
407
|
|
|
404
408
|
## iosignal stack
|
|
405
|
-

|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iosignal-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "IOSignal server and client CLI program.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
+
"iosignal-cli": "./bin/io-client.js",
|
|
7
8
|
"io-server": "./bin/io-server.js",
|
|
8
9
|
"io-client": "./bin/io-client.js",
|
|
9
10
|
"ios": "./bin/io-server.js",
|
|
@@ -12,15 +13,15 @@
|
|
|
12
13
|
"io-keygen": "./bin/io-keygen.js"
|
|
13
14
|
},
|
|
14
15
|
"author": {
|
|
15
|
-
"name": "Lee
|
|
16
|
-
"email": "
|
|
16
|
+
"name": "Taeo Lee",
|
|
17
|
+
"email": "sixgen@gmail.com"
|
|
17
18
|
},
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"boxen": "^8.0.1",
|
|
21
22
|
"chalk": "^5.3.0",
|
|
22
|
-
"commander": "^
|
|
23
|
-
"iosignal": "^
|
|
23
|
+
"commander": "^13.1.0",
|
|
24
|
+
"iosignal": "^3.0.0",
|
|
24
25
|
"redis": "^4.7.0"
|
|
25
26
|
},
|
|
26
27
|
"repository": {
|
|
File without changes
|