当前位置:网站首页>[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
边栏推荐
- Plato Farm有望通过Elephant Swap,进一步向外拓展生态
- OpenCV宏定义
- MySQL introduction
- 尿酸酶丨Worthington猪肝尿酸酶的特征:
- How powerful can top "hackers" be? Internet access without signal, expert: high-end operation!
- GhostNets on Heterogeneous Devices via Cheap Operations
- [self] - brush questions BFS
- 【自】-刷题-数组
- 苹果官网正在更新维护 Apple Store,国行 iPhone 13 / Pro 等产品将最高优惠 600 元
- The classic dual stack implementation queue, pay attention to the modification of the judgment conditions of traversing the stack.
猜你喜欢

MySQL introduction

使用Pytorch快速训练网络模型

2022 R2 mobile pressure vessel filling test question simulation test platform operation

Okaleido生态核心权益OKA,尽在聚变Mining模式

My second uncle is angry and swipes the screen all over the network. How can he cure my spiritual internal friction?

RHCE first day

控件 圆角描边 MaterialShapeDrawable

Custom MVC principle and framework

2022 G2 power plant boiler stoker examination question bank simulated examination platform operation

RHCE the next day
随机推荐
Zabbix 5.0 使用自带Redis模版监控
hutool官网(hutool好用吗)
齐博建站指南(艾戈勒)
电商数据模型设计
电脑不知卸载什么,打不开计算器无法编辑截图功能打不开txt文件等等解决方案之一
[self] - brush questions array
Wildcard ssl/tls certificate
宝塔 phpmyadmin未授权访问漏洞
Best practices for migration of kingbasees v8.3 to v8.6 of Jincang database (3. Kingbasees migration capability support system)
Jincang database kingbasees client programming interface guide ODBC (5. Development process)
NPDP考试需要携带什么?文具携带说明
Exchange 2013 SSL证书安装文档
【自】-刷题-动态规划
[data mining engineer - written examination] Dahua shares in 2022
Multisensor fusion positioning (III) -- inertial technology
2022 R2 mobile pressure vessel filling test question simulation test platform operation
深度剖析集成学习Xgboost(续)
[self] - brush questions BFS
[self] - question brushing - string
Class, leetcode919 -- complete binary tree inserter