14 lines
754 B
JavaScript
14 lines
754 B
JavaScript
let wss = "ws://" + window.location.hostname + ":3001" // Build socketio endpoint from window.location
|
|
const socket = io(wss); // Connect to socketio server
|
|
|
|
// ######################################################################################################################################################
|
|
// Websockets event handler
|
|
// ######################################################################################################################################################
|
|
|
|
socket.on('connected', (message) => {
|
|
console.log("Connected");
|
|
});
|
|
|
|
socket.on('refresh', (message) => {
|
|
document.location.reload() // Reload page on received 'refresh' messagen
|
|
}); |