fix(llc): make ws reconnection more robust
This commit is contained in:
@@ -374,6 +374,7 @@ class StreamChatClient {
|
|||||||
final event = await _ws.connect(user);
|
final event = await _ws.connect(user);
|
||||||
return user.merge(event.me);
|
return user.merge(event.me);
|
||||||
} catch (e, stk) {
|
} catch (e, stk) {
|
||||||
|
_wsConnectionStatus = ConnectionStatus.disconnected;
|
||||||
logger.severe('error connecting ws', e, stk);
|
logger.severe('error connecting ws', e, stk);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,8 +190,12 @@ class WebSocket with TimerHelper {
|
|||||||
_connectionStatus = ConnectionStatus.connecting;
|
_connectionStatus = ConnectionStatus.connecting;
|
||||||
connectionCompleter = Completer<Event>();
|
connectionCompleter = Completer<Event>();
|
||||||
|
|
||||||
final uri = await _buildUri();
|
try {
|
||||||
_initWebSocketChannel(uri);
|
final uri = await _buildUri();
|
||||||
|
_initWebSocketChannel(uri);
|
||||||
|
} catch (e, stk) {
|
||||||
|
_onConnectionError(e, stk);
|
||||||
|
}
|
||||||
|
|
||||||
return connectionCompleter!.future;
|
return connectionCompleter!.future;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user