let socket = new WebSocket("ws://localhost:8080/ws");

socket.onmessage = function(event) {

    console.log(event.data);


}

socket.onopen = function(event) {
    console.log("open socket");
}

socket.onclose = function(event) { 
    console.log("close socket");
}

socket.onerror = function(event) {
    console.log("error");
}