stream-chat-swift
                                
                                 stream-chat-swift copied to clipboard
                                
                                    stream-chat-swift copied to clipboard
                            
                            
                            
                        Token provider keeps retrying after calling disconnect
What did you do?
After calling connect (of the chatclient) If the tokenProvider request fails (our server returns an error) and I call disconnect I keep getting the retries to fetch token.
What did you expect to happen?
Calling disconnect should completely stop any type of callback excution from the token provider.
What happened instead?
I keep getting the callback invoked until the retry limit is hit. Even after disconnection.
GetStream Environment
GetStream Chat version: 4.48.0 GetStream Chat frameworks: StreamChatSwiftUI 4.48.0 iOS version: 17.2 Swift version: 5 Xcode version: 15.2 Device: Simulator iPhone 15. pro
Additional context
In my app I create the ChatClient at the start of my app launch but I only wish to connect to the websockets and such (calling connect) only when the user opens a particular chatchannel and I would like to kill those connections when that screen is closed. So I'm only calling connect before presenting a channel and disconnect when the user closes the channel screen.
Hi @fceldeiro,
We will investigate this one as soon possible. But, the first question I have is, why is your server returning an error in the token provider? Is that consistent or just something you noticed happening?
Best, Nuno
Hello @nuno-vieira , we were testing error cases, so we made the service intentionally fail to test those error scenarios and handle them properly in the app. That's when i noticed this behavior (of the callback been called until the retry limit even after calling disconnect).
Hello @nuno-vieira , we were testing error cases, so we made the service intentionally fail to test those error scenarios and handle them properly in the app. That's when i noticed this behavior (of the callback been called until the retry limit even after calling disconnect).
Makes sense 👍 Thank you!
Hello @fceldeiro !
Just to let you know, the fix will come on the next release. We will let you know once it is published.
Thanks for the report!
Best, Nuno