Hello , Senbird SDK v 3.0.197 (iOS Obj-C example code) , I see that method “didReconnect” from SBNetworkDelegate has never called , can you tell us more about what kind of bug it is? Would some alternative such as method “didSucceedReconnection” from SBDConnectionDelegate do the similar job?
In short, what is the best way to refresh conversations when network is reconnected, any suggestion?
didReconnect
is called when you call reconnect
method. Did you add addLocalNetworkDelegate:
?
sorry I dont see “addLocalNetworkDelegate:” , official example GroupChannelChatViewController class has =>
// TODO: Fix bug in SDK.
[SBDConnectionManager addNetworkDelegate:self identifier:self.description];
can you give me more info if this fixed in some version, or simple can you give me example when you are offline and internet connection is active again which method are called from any delegates related to this point?
Hi. I hope you are well. Aside from the ongoing conversation with @Woo I wanted to provide you with Sendbird’s Connection Manager FAQ document. I hope it helps you understand a bit more about what is going on under the hood.
SendBird Connection FAQ - External (4).pdf (216.0 KB)
@Jason Thank you Jason, the flow is clear thats ok. Please can you give me more info about comment // TODO: Fix bug in SDK. for connection manager in Objc-official example?
I will look up the bug and ask internally. In the mean time please consider the points I make below.
- If the internet is off for less than 45 seconds Sendbird’s connection manager will handle the reconnection case.
- When the connection is returned didSucceedReconnection fires. Once didSucceedReconntection fires consider to call the channel list again if the user is viewing the channel list, and call to refresh the channel if the user is viewing the message list.
- If the internet is lost for more than 45 seconds didFailReconnection will fire.
- From this point on you will need to call reconnect when the internet returns. As far as I’m aware detecting internet return will come from your side. This blog post might help with that.
Current implementation on didReconnect is it will be fired only if reconnection had happened from some network error. Why don’t you just use didSucceedReconnection
and refresh conversation when network is reconnected?
and what do you mean by “sorry I dont see “addLocalNetworkDelegate:””? use + (void)addLocalNetworkDelegate:(id<SBDNetworkDelegate> _Nonnull)delegate identifier:(nonnull NSString *)identifier
to add network delegate if you needs. Both didSucceedReconnection
and didReconnect
will get fired when reconnection was succeeded, but didSucceedReconnection
will get always get fired where didReconnect
will only get fired if reconnection had happened due to some error.