Socket errors handling. Closes [#37] as well

This commit is contained in:
estevez
2018-09-16 15:47:27 +03:00
parent 9e23b92a33
commit 9c7a878bb1
2 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,8 @@ class HassioDataModel {
} else {
_fetchingTimer = new Timer(new Duration(seconds: 10), () {
_fetchCompleter.completeError({"message": "Data fetching timeout."});
_hassioChannel.sink.close();
_hassioChannel = null;
});
_fetchCompleter = new Completer();
_reConnectSocket().then((r) {
@ -139,7 +141,7 @@ class HassioDataModel {
debugPrint(" $message");
_hassioChannel.sink.add(message);
}).catchError((e){
debugPrint("Unable to connect for sending =(");
debugPrint("Unable to connect for sending: $e");
});
}