fix reconnection event
This commit is contained in:
@@ -425,7 +425,8 @@ class StreamChatClient {
|
||||
online: status == ConnectionStatus.connected,
|
||||
));
|
||||
|
||||
if (currentState == ConnectionStatus.connected) {
|
||||
if (currentState == ConnectionStatus.connected &&
|
||||
previousState != ConnectionStatus.connected) {
|
||||
// connection recovered
|
||||
final cids = state.channels.keys.toList(growable: false);
|
||||
if (cids.isNotEmpty) {
|
||||
@@ -437,14 +438,12 @@ class StreamChatClient {
|
||||
await sync(cids: cids, lastSyncAt: _lastSyncedAt);
|
||||
}
|
||||
}
|
||||
if (previousState != ConnectionStatus.connected) {
|
||||
handleEvent(Event(
|
||||
type: EventType.connectionRecovered,
|
||||
online: true,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Stream of [Event] coming from [_ws] connection
|
||||
/// Pass an eventType as parameter in order to filter just a type of event
|
||||
|
||||
Reference in New Issue
Block a user