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