Skip to content

Hadle event for true recconect #24

@devprog777

Description

@devprog777

If reccont is true you must handle any Error Exception and Logic for any errro Example:

  1. if connection initialized and server up down

  2. 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-0089

    print('Exception: $e');
    // _attemptReconnectIfNeeded();
    });`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions