1 Star 0 Fork 19

姜承録 / cyrpc框架

forked from 陈不不 / cyrpc框架 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cyrpc.js 2.20 KB
一键复制 编辑 原始数据 按行查看 历史
陈不不 提交于 2022-04-10 10:21 . cyrpc框架
!function (a) {
new Promise((e, s) => {
e(a)
}
).then((cbbiyhh) => {
var cbb_MyId = "1001";
var cbb_vvnn = WebSocket;
ws = new cbb_vvnn("ws://127.0.0.1:5679/cbb");
console.log("10id")
ws.onopen = function () {
console.log("11id")
ws.send(cbb_MyId+"---");
}
;
ws.onmessage = function (evt) {
if (evt.data == 'c~c') {
console.log('pp')
ws.send(cbb_MyId+'---'+'c~c')
return;
}
console.log('传入数据: ' + evt.data);
var data = [];
if (evt.data.length == 0) {
data.push(cbbiyhh());
ws.send(JSON.stringify(data))
data = []
} else {
var typeOfDate = evt.data[0];
switch (typeOfDate) {
case "A":
var dataInfo = JSON.parse(evt.data.slice(1));
data.push(cbbiyhh(dataInfo));
break
case "O":
var dataInfo = JSON.parse(evt.data.slice(1))
data.push(cbbiyhh(dataInfo));
break
case "S":
data.push(cbbiyhh(evt.data.slice(1)));
break
case "I":
data.push(cbbiyhh(parseInt(evt.data.slice(1))));
break
}
;
console.log(cbb_MyId+'---'+JSON.stringify(data));
ws.send(cbb_MyId+'---'+JSON.stringify(data));
data = []
}
;
}
;
ws.onclose = function () {
console.log("rpc已经断开了哦");
};
ws.onerror = function () {
console.log("rpc已经断开了哦");
};
}
)
;
}(nn)
1
https://gitee.com/vagrantear/cyrpc-framework.git
git@gitee.com:vagrantear/cyrpc-framework.git
vagrantear
cyrpc-framework
cyrpc框架
master

搜索帮助