当前位置:网站首页>[detailed and super simple] how to use websocket links
[detailed and super simple] how to use websocket links
2022-07-28 23:52:00 【Mu Qing】

created:
this.contactSocket()methods
contactSocket(){
let webSocket = null;
let socketOpen = false;
let that=this
if ("WebSocket" in window) {
webSocket = new WebSocket("ws:// From the backstage url");
webSocket.onopen = function (){
console.log(" Successful connection !");
webSocket.send(that.token)
socketOpen = true
};
webSocket.onmessage = function (evt) {
var received_msg = evt.data;
console.log(" Receive a message :" + received_msg);
};
webSocket.onclose = function () {
console.log(" Connection is closed !");
that.reconnect()
};
webSocket.onerror = function () {
console.log(" Abnormal connection !");
};
}
},
// Reconnection
reconnect(){
console.log(' Reconnect the ')
setInterval(this.contactSocket(), 10000)
},Just change the link call directly , It's simple
边栏推荐
- PMP考试倒计时,速看3A通关锦囊!
- Asynchronism and synchronization of visa write and read functions by LabVIEW
- My second uncle is angry and swipes the screen all over the network. How can he cure my spiritual internal friction?
- General paging - front desk
- 台式机dp接口在哪(主机没有dp接口怎么办)
- Worthington丨Worthington胰蛋白酶化学性质及相关研究
- 深度剖析集成学习Xgboost
- 剑指 Offer 41. 数据流中的中位数
- E-commerce data model design
- How to add the index of a set in mongodb to another set in mongodb
猜你喜欢

Arduino uno driver universe 1.8 'TFT SPI screen example demonstration (including data package)

Zabbix 5.0 使用自带Redis模版监控

Worthington丨STEMxyme的分类和测定方法

Blocking queue

field injection is not recommended 的解决办法

Class, leetcode919 -- complete binary tree inserter

General addition, deletion, modification and query of custom MVC
![[self] - brush questions array](/img/a9/d12c41183df6961b2e9dd7cb49dfec.png)
[self] - brush questions array

Plato Farm有望通过Elephant Swap,进一步向外拓展生态

剑指 Offer 55 - I. 二叉树的深度
随机推荐
Equipped with a new generation of ultra safe cellular batteries, Sihao aipao is available from 139900 yuan
台式机dp接口在哪(主机没有dp接口怎么办)
【CNN】为什么CNN的卷积核大小一般都是奇数
Blocking queue
2022 R2 mobile pressure vessel filling test question simulation test platform operation
使用Pytorch快速训练网络模型
Worthington丨STEMxyme的分类和测定方法
Optimization and implementation of custom MVC
[self] - brush questions set
经典的拓扑排序问题——LeetCode207 课程表+LeetCode210 课程表II
【自】-刷题-数组
2022 R2 mobile pressure vessel filling test question simulation test platform operation
经典双栈实现队列,注意遍历栈的判定条件修改。
酪氨酸脱羧酶丨Worthington粪链球菌酪氨酸脱羧酶的特征
sql 左连接,内连接 的写法「建议收藏」
AUTOCAD——Excel表格导入CAD、CAD合并两兄弟
【自】-刷题-BFS
Manufacturing steps of interactive slide screen in exhibition hall
迅为IMX6开发板QT系统创建AP热点基于RTL8723-交叉编译iptables
什么是驱动程序签名,驱动程序如何获取数字签名?