diff --git a/lib/client/components/logger/index.tsx b/lib/client/components/logger/index.tsx
index f85dd9a34..bdce1fc41 100644
--- a/lib/client/components/logger/index.tsx
+++ b/lib/client/components/logger/index.tsx
@@ -747,7 +747,7 @@ const LogComp = ({
{isLoading && }
{errors.length ? (
-
{JSON.stringify(errors)}
+ {JSON.stringify(errors, null, 2)}
) : (
logs.length > 0 && (
{
useDebounce(
() => {
if (typeof window !== 'undefined') {
- try {
- sockPromise.current = new Promise((res, rej) => {
- let rejected = false;
- try {
- // eslint-disable-next-line new-cap
- const w = new wsock.w3cwebsocket(`${socketUrl}/ws`, '', '', {});
-
- w.onmessage = onMessage;
-
- w.onopen = () => {
- res(w);
- };
-
- w.onerror = (e) => {
- console.error('socket closed:', e);
- if (!rejected) {
- rejected = true;
+ const connnect = (recon = () => {}) => {
+ try {
+ sockPromise.current = new Promise(
+ (res, rej) => {
+ try {
+ // eslint-disable-next-line new-cap
+ const w = new wsock.w3cwebsocket(
+ `${socketUrl}/ws`,
+ '',
+ '',
+ {}
+ );
+
+ w.onmessage = onMessage;
+
+ w.onopen = () => {
+ res(w);
+ };
+
+ w.onerror = (e) => {
+ console.error(e);
+ recon();
+ };
+
+ w.onclose = () => {
+ recon();
+ };
+ } catch (e) {
rej(e);
}
- };
+ }
+ );
+ } catch (e) {
+ logger.error(e);
+ }
+ };
- w.onclose = () => {};
- } catch (e) {
- rej(e);
- }
- });
- } catch (e) {
- logger.error(e);
- }
+ connnect(() => {
+ setTimeout(() => {
+ console.log('reconnecting');
+ connnect();
+ }, 1000);
+ });
}
},
1000,