/** * Main Javascript file * * @author Open Mind * @date 27/06/2018 * @time 17:42 */ $(function () { var ws = new WebSocket('ws://localhost:80'); ws.onopen = function () { console.log('websocket connection stabilita...') ws.send('hello') } ws.onmessage = function (message) { console.log('Messaggio ricevuto :',message); } $('form').on('submit', function () { $('form input,select').prop('disabled', false); setTimeout(function () { $('form input,select').prop('disabled', true); }, 500); }); setInterval(() => { fetch('/omlink/getserverstatus') .then(resp => { if (resp.status == 200) return resp.json(); else return Promise.reject("getserverstatus: error"); }) .then(data => { $('#sysmsgnum').html(data.notify); }) .catch(err => { console.log(err); }); }, 5000); });