The spec was not being properly followed

This commit is contained in:
Diogo Cordeiro 2018-10-08 11:15:44 +01:00
parent 6b9d49cbca
commit 20323fd54c

View File

@ -5,7 +5,6 @@ var ws = new WebSocket('ws://localhost:3030/');
ws.addEventListener('open', function open() { ws.addEventListener('open', function open() {
console.log('connected'); console.log('connected');
ws.send(Date.now().toString(), {mask: true});
}); });
ws.addEventListener('close', function close() { ws.addEventListener('close', function close() {
@ -13,20 +12,20 @@ ws.addEventListener('close', function close() {
}); });
ws.addEventListener('message', function message(data, flags) { ws.addEventListener('message', function message(data, flags) {
console.log('Server response: ' + data.data, flags); console.log('IR Server response: ' + data.data, flags);
}); });
document.getElementById("ingestion-rate-update").addEventListener('click', function() { document.getElementById("ingestion-rate-update").addEventListener('click', function() {
if (document.getElementById("ingestion-rate-min").value != current_ingestion_rate) { if (document.getElementById("ingestion-rate-min").value != current_ingestion_rate_min) {
ws.send(document.getElementById("ingestion-rate-min").value, {mask: true}); ws.send("set-min::" + document.getElementById("ingestion-rate-min").value, {mask: true});
current_ingestion_rate_min = "set-min::" + document.getElementById("ingestion-rate-min").value; current_ingestion_rate_min = document.getElementById("ingestion-rate-min").value;
} }
if (document.getElementById("ingestion-rate-max").value != current_ingestion_rate) { if (document.getElementById("ingestion-rate-max").value != current_ingestion_rate_max) {
ws.send(document.getElementById("ingestion-rate-max").value, {mask: true}); ws.send("set-max::" + document.getElementById("ingestion-rate-max").value, {mask: true});
current_ingestion_rate_max = "set-max::" + document.getElementById("ingestion-rate-max").value; current_ingestion_rate_max = document.getElementById("ingestion-rate-max").value;
} }
if (document.getElementById("ingestion-rate-per").value != current_ingestion_rate) { if (document.getElementById("ingestion-rate-per").value != current_ingestion_rate_per) {
ws.send(document.getElementById("ingestion-rate-per").value, {mask: true}); ws.send("set-period::" + document.getElementById("ingestion-rate-per").value, {mask: true});
current_ingestion_rate_per = "set-period::" + document.getElementById("ingestion-rate-per").value; current_ingestion_rate_per = document.getElementById("ingestion-rate-per").value;
} }
}); });