centrifuge-js icon indicating copy to clipboard operation
centrifuge-js copied to clipboard

No description for error codes

Open GadiRiversideFM opened this issue 1 year ago • 3 comments

Is there any docs/description regarding the error msgs that are emitted from the centrifuge instance error event? for example timeout or transport closed which are very common to see on production logs. thanks G

GadiRiversideFM avatar Oct 25 '23 12:10 GadiRiversideFM

Hello,

timeout error happens on operation timeouts. Since network involved this will always happen from time to time.

transport closed error happens when operation tries to be executed - but underlying transport is closed. This will also happen from time to time as network connections are involved.

All error codes listed here:

https://github.com/centrifugal/centrifuge-js/blob/0af6fd3717ff409bdb408d86ded500d2d2bad48a/src/codes.ts#L1

The SDK generally survives network issues, reconnects and resubscribes to channels, handles subscription timeouts. But if you get errors upon calling some individual operations like RPC, presence, presence stats, history, publish - then you need to handle retry logic yourself.

FZambia avatar Nov 03 '23 06:11 FZambia

@FZambia timeout means the operation failed and terminated or it's postponed for later?

GadiRiversideFM avatar Nov 23 '23 10:11 GadiRiversideFM

It means that response to the issued request not received from server in a configured time. centrifuge-js automatically handles tmeouts on initial connection or subscriptions - by reconnecting or resubscribing. For individual operations like publish/presence/rpc - timeout is just an error which is not retried by the SDK.

FZambia avatar Nov 23 '23 12:11 FZambia