var comm_dev = new WebSocket(baseUrl_ws)
comm_dev.onopen = function () {
Info = {
}
comm_dev.send(JSON.stringify(Info))
}
comm_dev.onmessage = function (event){
// do something
}
comm_dev.onerror = function () {
myalert_waring('注意!实时连接已断开请重新载入网页')
};
comm_dev.onclose = function () {
layer.alert('WS连接失败,请重试!')
}
if ("WebSocket" in window) {
myalert_success(您的浏览器支持 WebSocket!)
} else {
myalert_error("您的浏览器不支持 WebSocket!")
}
WS长连接
最新推荐文章于 2024-04-24 04:32:14 发布