How to catch SocketError and re-connect?
I'm using Socket from platform package to do client websocket connection. It all works fine, but socket is dropped like after 2 - 3 hrs, and I need to know what happened, and re-connect.
As you can see below,
But as you can see here,
- log error events (ws.onerror)
- re-connect when error happened
Much appreciated, thanks in advance!
As you can see below,
closeCodeIsError called log returns 1006 code. But I want to get more error details that's fired in ws.onerror, and do ws re-connection. But as you can see here,
fromWebSocket says never Error, which means i can't catch error here? I might misunderstand this as I'm not good at effect.ts yet. So, basically, I want to achieve 2 things;- log error events (ws.onerror)
- re-connect when error happened
Much appreciated, thanks in advance!
GitHub
An ecosystem of tools to build robust applications in TypeScript - Effect-TS/effect
