【发布时间】:2018-04-21 03:28:22
【问题描述】:
这是我的代码不起作用:
connectSocket: function () {
this.socket = new WebSocket('ws://144.0.0.0:8080'); //IP Changed
this.socket.onopen = function(event) {
console.log("Connected to the Web Socket Server");
this.socket.send("Opponent has joined.");
};
alert("You're now connected to the server. Be careful out there.");
this.socket.onmessage = function(event) {
console.log("Message Received From Server :", event);
//This is the time to interact with this specific
};
}
我引用的代码是我的 vue 中调用身份验证的方法。我只是想向 Web Socket 服务器发送和接收基本数据。然而,这是有缺陷的地方......我该如何解决这个问题并保持身份验证?
【问题讨论】:
标签: mongodb express vue.js websocket undefined