瀏覽代碼

upload

dev
HolyKnightIX 1 年之前
父節點
當前提交
83cf71ac84
共有 1 個檔案被更改,包括 26 行新增3 行删除
  1. +26
    -3
      src/views/realTimeChat/realTimeChat.vue

+ 26
- 3
src/views/realTimeChat/realTimeChat.vue 查看文件

@@ -130,11 +130,34 @@ export default {
},

socketOnLink() {
this.socket = new WebSocket("wss://43.143.227.135:8989/webrtc");
const url = document.location.host;
this.socket = new WebSocket("wss://" + url);

this.socket.onclose = function (evt) {
console.log("连接已断开.");
this.socket.onopen = (success) => {
console.log(success, "连接成功!");
};

this.socket.onclose = (evt) => {
console.log(evt, "连接已断开!");
};

this.socket.onerror = (evt) => {
console.log(evt, "连接失败");
};

this.socket.onmessage = (e) => {
console.log(e, "e");
};
},

socketLogin() {
let req = new Object();
req.cmd = "CMD_USER_LOGIN";
req.username = "Passager";
req.password = "123456";
req.agent = "browser";
let str = JSON.stringify(req);
this.socket.send(str);
},
},
created() {},


Loading…
取消
儲存