This commit is contained in:
Mateusz Gruszczyński
2026-09-17 13:11:37 +02:00
parent 86a6fa1f2f
commit eede4e88e6
10 changed files with 145 additions and 20 deletions
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright (C) 2026 Mateusz Gruszczyński @linuxiarz.pl
* Source-Available Code / Dual-Licensed.
*
* Free for non-commercial and evaluation use under terms of BSL/GPLv3.
* Commercial or production use requires a valid paid license.
* See LICENSE file in repository root for details.
*/
export const CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS = 5;
export function reconnectStatus(attempt, networkOnline = true) {
const normalizedAttempt = Math.max(0, Number(attempt) || 0);
if (!networkOnline || normalizedAttempt < CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS) return "reconnecting";
return "error";
}