diff --git a/lib/screens/channel/chat/stores/chat_store.dart b/lib/screens/channel/chat/stores/chat_store.dart index 594d6236..8393f569 100644 --- a/lib/screens/channel/chat/stores/chat_store.dart +++ b/lib/screens/channel/chat/stores/chat_store.dart @@ -57,6 +57,8 @@ abstract class ChatStoreBase with Store { StreamSubscription? _sevenTVChannelListener; + static const _maxRetries = 5; + // The retry counter for exponential backoff. var _retries = 0; @@ -451,6 +453,15 @@ abstract class ChatStoreBase with Store { onDone: () async { if (_channel == null) return; + if (_retries >= _maxRetries) { + messageBuffer.add( + IRCMessage.createNotice( + message: 'Disconnected from chat', + ), + ); + return; + } + if (_backoffTime > 0) { // Add notice that chat was disconnected and then wait the backoff time before reconnecting. final notice =