Here is my code that is not working:
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
};
}
The code I am referencing is a method in my vue called upon authentication. I am merely trying to send and receive basic data to the Web Socket Server. However somewhere this is flawed... How could I fix this and maintain authentication?