25 lines
552 B
JavaScript
Raw Normal View History

2019-06-15 11:54:30 +03:00
import "bootstrap/dist/css/bootstrap.min.css";
window.onload = function () {
console.log("hello to1")
};
let socket = new WebSocket("ws://ip:port");
socket.onopen = function(e) {
console.log("Waaaa ebsocket was opened: " + JSON.stringify(e));
};
socket.onmessage = function(event) {
console.log("Message was received: " + JSON.stringify(event))
};
socket.onclose = function(event) {
console.log("Websocket was closed. Cause: " + JSON.stringify(event))
};
socket.onerror = function(error) {
console.log("Error: " + JSON.stringify(error))
};