-
Notifications
You must be signed in to change notification settings - Fork 16
Subscription.messages
leaks messages
#3
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
Comments
@are Seems like issue is not yet fixed It is still leaking messages. Push notifications are fixed though in latest release. |
I have properly unsubscribed/cancelled subscriptions in dispose() method but I can still see duplicate subscriptions when I return back to "chat screen". I confirmed the same using below code in initState() method -
|
Could you post the code where you subscribe? I cannot replicate this issue anymore. |
Code inside initState() =>
code inside dispose() =>
chatService's subscribeToChannel() method =>
Pubnub initialization =>
|
So this is actually not the same issue. The code is behaving as intended: every time you call the |
Actaully they are receiving new messages. If I revisit "chat screen" 5 times then I can see 5 subscriptions and hence I am receiving new messages 5 times. First 4 callbacks were calling setState() on the state object which had been disposed, that's why I am checking if state is mounted or not first. If I called unsubscribe on subscription when I pressed back button then It should not receive messages when I come back to the screen. |
I am pushing a fix that may fix this, but in the meantime - can you make sure that the Also, I don't recommend creating a subscription every time you leave a view - it would be a better idea to have one created permamently and then calling |
I am sure dispose is called because the route is being popped from the navigator stack and I also confirmed it with a print statement. I think I can use global listener but for now |
I've released |
Sure thing. I will let you know if it worked out for me when I try it. |
Description
Subscription.messages
stream is not closed onSubscription.unsubscribe
and leads to leaking messages.Steps to reproduce:
a
.subscription.messages
stream.subscription.unsubscribe()
.a
.The text was updated successfully, but these errors were encountered: