当前位置:网站首页>websocket实现实时变化图表内容
websocket实现实时变化图表内容
2022-08-10 14:33:00 【路光.】
1.连接服务器
var ws=new WebSocket("ws://192.168.0.232:8080");
2.连接成功触发
ws.onopen=function (){
alert('连接成功');
}
3.连接失败触发
ws.οnerrοr=function(){
alert('连接失败')
}
//接收消息时触发
ws.onmessage=((MessageEvent){
var data=JSON.parse(MessageEvent.data);
option.series[0].data=data;
myChart.setOption(option);
})
边栏推荐
猜你喜欢
随机推荐
领域驱动模型设计与微服务架构落地-从项目去剖析领域驱动
laravel 抛错给钉钉
重要通知 | “移动云杯”算力网络应用创新大赛初赛延期!!
符合信创要求的堡垒机有哪些?支持哪些系统?
FPN详解
E. Cross Swapping(并查集变形/好题)
从全球价值链视角看,京东云数智供应链对未来经济有何影响?
Understanding_Data_Types_in_Go
fatal error C1083 无法打开包括文件'io.h' No such file
Unfinished mathematics test paper ----- test paper generator (Qt includes source code)
MySQL interview questions
线上线下课程教学培训小程序开发制作功能介绍
2011年下半年 系统架构设计师 下午试卷 II
[JS Advanced] Creating sub-objects and replacing this_10 in ES5 standard specification
WSL 提示音关闭
物资采购小程序开发制作功能介绍
Lack of comparators, op amps come to the rescue!(Op amp is recorded as a comparator circuit)
老板加薪!看我做的WPF Loading!!!
Azure IoT 合作伙伴技术赋能工作坊:IoT Dev Hack
JS入门到精通完整版