stream-chat-swift icon indicating copy to clipboard operation
stream-chat-swift copied to clipboard

Token provider keeps retrying after calling disconnect

Open fceldeiro opened this issue 1 year ago • 4 comments

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.

fceldeiro avatar Feb 14 '24 18:02 fceldeiro

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

nuno-vieira avatar Feb 15 '24 11:02 nuno-vieira

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).

fceldeiro avatar Feb 15 '24 11:02 fceldeiro

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!

nuno-vieira avatar Feb 15 '24 11:02 nuno-vieira

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

nuno-vieira avatar Mar 04 '24 15:03 nuno-vieira

Hey @fceldeiro,

This fix has been released as part of 4.50.0

Best, Alexey

testableapple avatar Mar 12 '24 13:03 testableapple