-
Notifications
You must be signed in to change notification settings - Fork 16
Description
If reccont is true you must handle any Error Exception and Logic for any errro Example:
-
if connection initialized and server up down
-
if server up down and you initialized connection
` .catchError((error) {
if (error is SocketException) {
// Обработка работает
if(error.osError!.errorCode == 110){
// SocketException: OS Error: Connection timed out, errno = 110 If server connection close
// Логика для обработки ошибки 110 сервер не доступен, при инницилизации подключения
// Функция для переподклбчения
// Logic for this error
print('Ошибка поймана: ${error.osError!.errorCode}');
}} else {
// if connection initialized and server up down - I/flutter (14205): Exception: ClientException: Connection closed before full header was received, uri=http://url:3000/iot?host=abfarm-us-west1-c-0089
print('Exception: $error');}
}).catchError((e) {
// Количесвто возможных ошибок (2) не включая когда отключают adapter wifi или eth это 3
// Еще проверить когда отключают adapter wifi или eth это 3
// 1. Когда подключение инициированно, после отключения сервера ошибка ->
// - I/flutter (14205): Exception: ClientException: Connection closed before full header was received, uri=http://url:3000/iot?host=abfarm-us-west1-c-0089
// 2. Когда сервер недоступен при инницирование подключение
// - Exception: ClientException with SocketException: Connection timed out (OS Error: Connection timed out, errno = 110), address = url, port = 33678, uri=http://url:3000/iot?host=abfarm-us-west1-c-0089print('Exception: $e');
// _attemptReconnectIfNeeded();
});`