From 99a51de9f63701961bbcebea9db01aaaf4ffdb2e Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 1 Jun 2024 21:41:40 +0800 Subject: [PATCH] :bug: Auto reconnect --- lib/providers/account.dart | 2 ++ lib/providers/chat.dart | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/providers/account.dart b/lib/providers/account.dart index 23fd408..eb7394c 100644 --- a/lib/providers/account.dart +++ b/lib/providers/account.dart @@ -84,9 +84,11 @@ class AccountProvider extends GetxController { }, onDone: () { isConnected.value = false; + Future.delayed(const Duration(milliseconds: 1000), () => connect()); }, onError: (err) { isConnected.value = false; + Future.delayed(const Duration(milliseconds: 1000), () => connect()); }, ); } diff --git a/lib/providers/chat.dart b/lib/providers/chat.dart index eb9b20c..2e3fa18 100644 --- a/lib/providers/chat.dart +++ b/lib/providers/chat.dart @@ -58,9 +58,11 @@ class ChatProvider extends GetxController { }, onDone: () { isConnected.value = false; + Future.delayed(const Duration(milliseconds: 1000), () => connect()); }, onError: (err) { isConnected.value = false; + Future.delayed(const Duration(milliseconds: 1000), () => connect()); }, ); }