1.0.2 • Published 11 months ago

node-seate-client v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

使用文档

如果你感觉本包对你起到一点点作用,请帮忙点个star Thanks♪(・ω・)ノ

安装依赖

npm i  

使用方式

必须先起服务后才可以使用本包,具体查看👇🏻【server关联信息】

注册client1服务

const client = require("../app")  

const mirco = new client("ws://localhost:8080", "client1")
trx = {
rollback: async () => {
console.log("数据回滚1")
},
commit: async () => {
console.log("数据提交1")
}
}
mirco.setTrx("1", trx) // 第一个参数:不会重复的值;第二个对象:参考上方代码

注册client2服务

const client = require("../app")  

const mirco = new client("ws://localhost:8080", "client2")
trx = {
rollback: async () => {
console.log("数据回滚1")
},
commit: async () => {
console.log("数据提交1")
}
}
mirco.setTrx("1", trx)

提交或回滚

const client = require("../app")  
 
const mirco = new client("ws://localhost:8080", "client3")  
setTimeout(() => {  
   console.log("发送信息")  
   mirco.toSend({  
       init: 3,  //默认这样写
       state: 1, //默认这样写
       serverNames: ["client1", "client2"], //对应client类的第二个参数
       key: "1"  // 对应mirco.setTrx方法的第一个参数
   })  
}, 3000)  

server关联信息

npm链接
github链接

client关联信息

npm链接
github链接

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago