1.无心跳,短开连接之后重新连。
class webSocketClass {
constructor(name) {
this.lockReconnect = false;
this.localUrl = "ws://XXXXXX";
this.wsUrl = "";
this.globalCallback = null;
this.userClose = false;
this.createWebSocket(name);
}
createWebSocket(url) {
let that = this;
that.wsUrl = url;
try {
that.ws = new WebSocket(that.localUrl + that.wsUrl);