|
@@ -40,29 +40,54 @@ if (room == "A1") {
|
|
|
}
|
|
|
var cUrl = isWSS ? "wss" : "ws" + "://" + wsUrl + "/card?cardIp=" + form.ip;
|
|
|
|
|
|
-var wsss = new WebSocket(cUrl);
|
|
|
-wsss.binaryType = 'arraybuffer';
|
|
|
+var wsss;
|
|
|
|
|
|
-wsss.onopen = function () {
|
|
|
- var pings = {
|
|
|
- "event": "getScreenStatus"
|
|
|
- }
|
|
|
- wsss.send(JSON.stringify(pings));
|
|
|
- var bitRate = {
|
|
|
- "data": {
|
|
|
- "bitRate": 2243000
|
|
|
- },
|
|
|
- "event": "bitRate"
|
|
|
- }
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(bitRate), form.sn))
|
|
|
-};
|
|
|
+function doConnect() {
|
|
|
+ wsss = new WebSocket(cUrl);
|
|
|
+ wsss.binaryType = 'arraybuffer';
|
|
|
|
|
|
-wsss.onclose = function (event) {
|
|
|
- console.log("onclose==============");
|
|
|
-};
|
|
|
-wsss.onerror = function (event) {
|
|
|
- console.log("onerror==============");
|
|
|
-};
|
|
|
+ wsss.onopen = function () {
|
|
|
+ var pings = {
|
|
|
+ "event": "getScreenStatus"
|
|
|
+ }
|
|
|
+ wsss.send(JSON.stringify(pings));
|
|
|
+ var bitRate = {
|
|
|
+ "data": {
|
|
|
+ "bitRate": 2243000
|
|
|
+ },
|
|
|
+ "event": "bitRate"
|
|
|
+ }
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(bitRate), form.sn))
|
|
|
+ };
|
|
|
+ wsss.onclose = function () {
|
|
|
+ $.confirm({
|
|
|
+ title: '提示',
|
|
|
+ text: '连接断开,是否准备重连?',
|
|
|
+ onOK: function () {
|
|
|
+ doConnect();
|
|
|
+ },
|
|
|
+ onCancel: function () {
|
|
|
+ wx.miniProgram.switchTab({
|
|
|
+ url: '/pages/home/home'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ wsss.onerror = function () {
|
|
|
+ $.confirm({
|
|
|
+ title: '提示',
|
|
|
+ text: '连接断开,是否准备重连?',
|
|
|
+ onOK: function () {
|
|
|
+ doConnect();
|
|
|
+ },
|
|
|
+ onCancel: function () {
|
|
|
+ wx.miniProgram.switchTab({
|
|
|
+ url: '/pages/home/home'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+}
|
|
|
$('#box').on("click", function () {
|
|
|
draw_graph('pencil', this)
|
|
|
})
|