1

I’m using supabase-js with a React app, implementing its realtime functionality to get real-time updates from the database in the UI. Overall it’s working great. Sometimes, though, the realtime channels will close (they stop working and I get a CLOSED event).

When that happens, I’d like to reopen them. Before I do, though, I’m not sure if I should first unsubscribe from the closed channel (supabase.removeChannel()). I’d assumed yes, but when I do that I get another CLOSED event on the old channel, which makes me wonder if the removeChannel() call is unnecessary (or even harmful).

Thanks!

Dave Feldman
  • 104
  • 1
  • 9
  • 28

1 Answers1

0

You should do removeChannel otherwise you'll end up opening a bunch of connections. Getting the CLOSED message after that is expected.