Attempt to fix worker timeout issue by forcing reconnect client side

This commit is contained in:
Peter Stockings
2023-01-26 17:19:25 +11:00
parent f79823b785
commit fe632b1a1b

View File

@@ -24,7 +24,12 @@ async function connect(props) {
console.log("> Notifications started");
characteristic.addEventListener("characteristicvaluechanged", props.onChange);
console.log("> Characteristic value changed event listener added");
socket = io();
socket = io({
reconnection: true,
reconnectionDelay: 1000,
reconnectionAttempts: 20,
forceNew: true,
});
socket.on("connect", () => {
btn.classList.remove("bg-red-600");
@@ -82,8 +87,8 @@ function parseCSC(e) {
console.log("CSC", res);
if (prevRes) {
let rpm = revsToRPM(prevRes, res);
if (rpm > 0)
socket.emit("message", { rpm: parseFloat(rpm.toFixed(2)), id: 1 });
//if (rpm > 0)
socket.emit("message", { rpm: parseFloat(rpm.toFixed(2)), id: 1 });
}
prevRes = res;
return res;