Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Realtime] RealtimeV2 auto-reconnects after calling disconnect() #612

Open
TiagoLira opened this issue Nov 26, 2024 · 1 comment · May be fixed by #627
Open

[Realtime] RealtimeV2 auto-reconnects after calling disconnect() #612

TiagoLira opened this issue Nov 26, 2024 · 1 comment · May be fixed by #627
Labels
bug Something isn't working

Comments

@TiagoLira
Copy link

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
@TiagoLira TiagoLira added the bug Something isn't working label Nov 26, 2024
@grdsdev
Copy link
Collaborator

grdsdev commented Nov 26, 2024

Hi @TiagoLira thanks for reporting, I'll be taking a look ASAP.

@grdsdev grdsdev linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants