app模板、应用模板、组件模板、widget模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
1.2 KiB

var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({ port: 9999 });
wss.on('connection', function (ws) {
console.log('client connected');
ws.on('message', function (message) {
console.log(message);
ws.send("服务端接收到请求后,发送给客户端的数据");
});
var i = 1;
setInterval(function () {
i++;
ws.send(JSON.stringify(
{
payload:{
message:{
"id":i,
"appName": "qwer",
"text": "我是一条推送测试"+i,
"type": "数据指挥",
"level":1,
"compnent":1,
"time": 1622972899706,
"title":"张三",
"reply":1,
"extra":{
"text":"这是一条附加信息"
}
},
msgType:"SILENT_APP",//NONTIFY_APP 打开对应的App SILENT_APP 框架处理消息
appId:"widget_demo_3"
},
type:"message"
}
))
}, 5000)
})