sms-client-lib
v0.2.2
Published
Sms Client
Downloads
3
Readme
Sms Client Lib
Client for State Machine Server socket.io server
install
npm i sms-client-lib
Usage to recive data
const ClientIo = require( "sms-client-lib" ) ;
var config = {
ip:"http://localhost",
port:8910
};
var reciver = new ClientIo(config);
reciver.onConnect.add(()=>{
console.log("=== RECIVER CONNECTED");
reciver.addListenerOnChange("test.onchanges.value1", (value)=>{
console.log("addListenerOnChange 1", value) ;
}) ;
reciver.addListenerOnChange("test.onchanges.value2", (value)=>{
console.log("addListenerOnChange 2", value) ;
}) ;
reciver.addListenerOnSet("test.onset.value1", (value)=>{
console.log("addListenerOnSet ", value) ;
}) ;
reciver.addListenerOnChangeLenth("test.onchangeLength.list1", (value)=>{
console.log("addListenerOnChangeLenth ", value) ;
}) ;
})
reciver.connect();
Usage to send data
var config = {
ip:"http://localhost",
port:8910
};
var sender = new ClientIo(config);
sender.onConnect.add(()=>{
console.log("=== SENDER CONNECTED");
//to set value
sender.set("test.onchanges.value1", "anything a") ;
//to reset value
sender.reset("test.onchanges.value2", {paramOfObject:"anything b"}) ;
//to send message
sender.message("test.onset.value1", ["anything c"]) ;
}) ;
sender.connect() ;