iosignal 0.0.1 → 1.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.
- package/README.md +171 -0
- package/auth_file.json +13 -0
- package/auth_file.mjs +23 -0
- package/dist/iosignal.cjs +2 -0
- package/dist/iosignal.esm.js +3 -0
- package/dist/iosignal.esm.js.map +1 -0
- package/dist/iosignal.min.js +3 -0
- package/dist/iosignal.min.js.map +1 -0
- package/img/iosignal_stack.png +0 -0
- package/index.js +19 -0
- package/indexWebBrowser.js +13 -0
- package/package.json +48 -6
- package/rollup.config.js +69 -0
- package/src/api/RedisAPI.js +68 -0
- package/src/api/api_constant.js +7 -0
- package/src/api/api_reply.js +34 -0
- package/src/api/api_sudo.js +96 -0
- package/src/auth/Auth_Env.js +78 -0
- package/src/auth/Auth_File.js +75 -0
- package/src/auth/Auth_Redis.js +50 -0
- package/src/auth/BohoAuth.js +168 -0
- package/src/client/CongPacket.js +150 -0
- package/src/client/IOCongSocket.js +88 -0
- package/src/client/IOCore.js +959 -0
- package/src/client/IOWS.js +81 -0
- package/src/client/IOWebSocket.js +96 -0
- package/src/common/constants.js +159 -0
- package/src/common/quotaTable.js +61 -0
- package/src/common/util.js +61 -0
- package/src/server/FileLogger.js +30 -0
- package/src/server/Manager.js +521 -0
- package/src/server/Metric.js +154 -0
- package/src/server/Server.js +136 -0
- package/src/server/ServerRemote.js +235 -0
- package/src/server/ServerRemoteCore.js +467 -0
- package/src/server/serverOption.js +55 -0
- package/test-browser/favicon.ico +0 -0
- package/test-browser/index.html +93 -0
- package/test-browser/server.js +8 -0
- package/test-client-nodejs/client.cjs +17 -0
- package/test-client-nodejs/client.mjs +17 -0
- package/test-client-nodejs/stateChange.mjs +19 -0
- package/test-server/server-commonjs.cjs +8 -0
- package/test-server/server-esm.mjs +19 -0
- package/test-server/test-Auth_Env.js +17 -0
- package/test-server/test-Auth_File.js +9 -0
- package/test-server/test-api_reply.js +10 -0
- package/test-server/test-api_sudo.js +11 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Server, serverOption } from '../index.js'
|
|
2
|
+
|
|
3
|
+
// serverOption.showMetric = 2;
|
|
4
|
+
// serverOption.showMessage = 'message';
|
|
5
|
+
// serverOption.port = '6666'
|
|
6
|
+
// serverOption.congPort = '6667'
|
|
7
|
+
|
|
8
|
+
const server = new Server( serverOption )
|
|
9
|
+
console.log( 'serverOption:', serverOption )
|
|
10
|
+
|
|
11
|
+
// text message handler (No binary message)
|
|
12
|
+
// print text message
|
|
13
|
+
// then reply.
|
|
14
|
+
server.on('text_message', (msg, remote)=>{
|
|
15
|
+
console.log('text_message from(cid): ', remote.cid, msg.toString() )
|
|
16
|
+
let result = { msg: msg, yourcid: remote.cid , date: new Date().toUTCString() }
|
|
17
|
+
let res = JSON.stringify( result )
|
|
18
|
+
remote.send( res )
|
|
19
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Server, serverOption , Auth_Env } from '../index.js'
|
|
2
|
+
|
|
3
|
+
serverOption.showMetric = 2;
|
|
4
|
+
serverOption.showMessage = 'message';
|
|
5
|
+
|
|
6
|
+
// You can use environment variable BOHO_AUTH
|
|
7
|
+
|
|
8
|
+
// $ BOHO_AUTH=id1.key1.255,id2.key2.200 node app.js
|
|
9
|
+
// process.env.BOHO_AUTH=id1.key1.255,id2.key2.200
|
|
10
|
+
|
|
11
|
+
// or, as constructor argument.
|
|
12
|
+
let authInfo = 'id1.key1.255,id2.key2.200'
|
|
13
|
+
|
|
14
|
+
let authManager = new Auth_Env( authInfo )
|
|
15
|
+
const server = new Server( serverOption, authManager )
|
|
16
|
+
// console.log( 'serverOption:', serverOption )
|
|
17
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Server, serverOption , Auth_File } from '../index.js'
|
|
2
|
+
|
|
3
|
+
serverOption.showMetric = 2;
|
|
4
|
+
serverOption.showMessage = 'message';
|
|
5
|
+
|
|
6
|
+
// const server = new Server( serverOption, new Auth_File('../authInfo.json') ) // JSON version. cannot add comments.
|
|
7
|
+
const server = new Server( serverOption, new Auth_File('../auth_file.mjs') ) // JS version. it support comments.
|
|
8
|
+
// console.log( 'serverOption:', serverOption )
|
|
9
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Server, serverOption ,api_reply } from 'iosignal'
|
|
2
|
+
serverOption.showMessage = 'message';
|
|
3
|
+
|
|
4
|
+
// no authManager
|
|
5
|
+
serverOption.port = 7777
|
|
6
|
+
const rs = new Server( serverOption )
|
|
7
|
+
// api response module
|
|
8
|
+
rs.api('reply', api_reply)
|
|
9
|
+
|
|
10
|
+
// console.log( 'serverOption:', serverOption )
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Server, serverOption ,api_sudo , Auth_Env } from 'iosignal'
|
|
2
|
+
serverOption.showMessage = 'message';
|
|
3
|
+
|
|
4
|
+
// authManager
|
|
5
|
+
serverOption.port = 7777
|
|
6
|
+
let authManager = new Auth_Env('admin.adminkey.255')
|
|
7
|
+
const rs = new Server( serverOption ,authManager )
|
|
8
|
+
// api response module
|
|
9
|
+
rs.api('sudo', api_sudo )
|
|
10
|
+
|
|
11
|
+
// console.log( 'serverOption:', serverOption )
|