remocon

0.29.0 • Public • Published

remocon ( remote-signal console )

NOTICE

The package name has been changed to iosignal-cli. Please use the new library name.

new github: iosignal-cli

new npmjs: iosignal-cli

supports

Windows, Mac, and Linux.

install

Linux, Mac and shell

$ sudo npm install -g remocon
# global install.

windows as root permission

$ npm install -g remocon
# global install.

remote-signal server

$ remote-server # or  use 'remocons'  alias
# start server with default option.
# default. open port 7777 with WebSocket. 


$ remote-server -l 5555 
# you can specify listen port number

remote-signal client

$ remote # or remocon alias
# connect to localhost:7777 with websocket.

# use -c to define websocket url and port number.
$ remote -c wss://websocket_server_url:port
$ remote -c ws://localhost:7777

# support ws or wss(TLS).

remote-signal commands

  • subscribe('tag')
  • publish('tag', message )
  • signal('tag', message ) // same with publish
  • not ready whole document.

tutorial

signaling

  • multi-cast: publish/subscribe channel_name
  • uni-cast: use cid(communication id)
  1. start server
$ remote-server
# or same alias
$ remocons 
  1. start client A.
$ remote
Connecting to ws://localhost:7777
ready:  cid: ?c3Nr 
# connected and receive client cid.
# CID(Communicaion Id of the remote client.)

> .subscribe channel_name  
# subscribe some channel
  1. start client B.
$ remote
Connecting to ws://localhost:7777
ready:  cid: ?rr75
> 
# connected and received cid.

# multicast.
> .signal channel_name some_message   

# unicast to A.
> .signal ?c3Nr@ direct_message  
# IMPORTANT. 
# unicast signal tag must include '@' charactor.  tag = 'cid' + @

authentication

type1. auth data from file.

  • for personal use only
  • raw plain password string. (Not Hashed)
  • each device have 4 values: deviceId, deviceKey, deviceCId, level
  • you can find sample auth_file.mjs and auth_file.json in root folder.
$ remote-server -d auth_file.json
   or
$ remote-server -d auth_file.mjs

auth_file.json structure

  • deviceId string size limit: 8 charactors.
  • No passphrase string limit. (It will be digested 32bytes with sha256.)
  • CID string size limit: current 20 chars. can be changed.
  • JSON file does not support comment.
[
  ["id","key","cid",0],
  ["did2","did2key","did2-cid",0],
  ["uno3","uno3-key","uno3-cid",1]
]

auth_file.mjs

  • support comments.
// *.mjs file support comments.
export const authInfo = [
  // device id, key, communication id, level:Number(0~255)
  ["did","passowrd","cid",0],  
  ["device1","device1_key","device1_cid",0],
  ["root","root-key","root-cid",255],  // default admin_root level is 255
  ["uno","uno-key","uno",1]
]

type2. auth data from Redis(or other DataBase)

  • Recommended
  • you can find source and examples here.
    • remote-siganl "/src/auth/"
    • remocon "/test_auth_redis/"

Before running the server, you need to make sure that your Redis server is up and running and that you have registered your device credentials. A simple credentials enrollment example is included in the source above.

start server with local redis-auth-system

$ remote-server -r   //  redis://localhost:6379

auth client

  1. start auth server.
  2. connect and login
$ remote
ready:  cid: ?YXDr
> .login uno3 uno3-key
try manual login:  uno3
> >> QUOTA_LEVEL :  1
current quota: {"signalSize":255,"publishCounter":10,"trafficRate":100000}
ready:  cid: uno3-cid
 
# now device have (pre-registered) CID.

Support for both web browsers and Arduino

Specifying two types of ports

RemoteSignal uses websockets for web browser peer connections. If you want to use an Arduino connection, you must specify the use of the CongSocket port using the -L option.

The -l option specifies the Websocket port, and the -L option specifies the CongSocket port for the Arduino.

$ remote-server -l 7777 -L 8888
# -l option for WebSocket port
# -L option for CongSocket port ( Arduino connection)

Readme

Keywords

none

Package Sidebar

Install

npm i remocon

Weekly Downloads

0

Version

0.29.0

License

MIT

Unpacked Size

22.4 kB

Total Files

12

Last publish

Collaborators

  • remocons