checkConnection method

void checkConnection()

Check connection online

Implementation

void checkConnection() {
  try {
    sendAndWaitMessage(
            this,
            SocketData.fromFullData({
              'message_id': Statics.getRandomId(20),
              'message_type': 'connection_confirmation',
              "data": {}
            }))
        .then((value) => null)
        .timeout(const Duration(seconds: 10), onTimeout: () {
      close();
    });
    // ignore: avoid_catches_without_on_clauses
  } catch (e) {
    close();
  }
}