SupabaseS
Supabase3mo ago
Ted H

Supabase realtime reconnect flow suggestion

Hi,

I'm currently designing the realtime reconnect logic for my react native app, so what I have been using is to listen to the status change like below

.subscribe((status) => {
 ... Do something...
}

What I'm not sure is that do I have to tackle both CHANNEL_ERROR and TIMEOUT events? Because as far as I have tested, no matter it's a TIMEOUT or a CHANNEL_ERROR event, it will always follow by a CLOSED event at the end. Instead of taking care of timeout and channel_error, can I just wait until the channel is closed by the server (CLOSED event received) and then do the reconnection logic?
Was this page helpful?