Attempt to fix worker timeout issue by forcing reconnect client side
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user