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