Closed
Description
Bug report
- [ x] I confirm this is a bug with Supabase, not with my own application.
- [ x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Version
supabase-swift 2.23.0
Describe the bug
I had asked before about the client not reconnecting, and it seems that it is reconnecting too well now :)
What happens is that after I call realtimeV2.disconnect()
, it immediately triggers an error on the client's messageTask
task and starts a reconnect.
I couldn't find any way to disconnect it properly.
To Reproduce
My use case is that I want to unsubscribe and disconnect when the app goes to the background.
When I connect I simply subscribe to a channel and listen for statusChanges.
When the app goes to background I run:
let realtime = client.realtimeV2
if let channel = realtimeChannel {
await realtime.removeChannel(channel)
}
realtime.disconnect()
realtimeChannel = nil
Right after this, the reconnect()
call is triggered on messageTask
.
Expected behavior
The client should not try to reconnect if disconnect()
is called.
System information
- OS: iOS 18