Skip to content

Commit

Permalink
Merge pull request #604 from appwrite/fix-flutter-websocket-issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar authored Feb 14, 2023
2 parents 263ecd9 + 108f894 commit a5decbf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions templates/flutter/lib/src/realtime_mixin.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ mixin RealtimeMixin {
}
break;
}
}, onDone: () {
for (var list in _channels.values) {
for (var stream in list) {
stream.close();
}
}
_channels.clear();
_closeConnection();
}, onError: (err, stack) {
for (var list in _channels.values) {
for (var stream in list) {
stream.sink.addError(err, stack);
}
}
if (_websok?.closeCode != null && _websok?.closeCode != 1008) {
debugPrint("Reconnecting in one second.");
Future.delayed(Duration(seconds: 1), _createSocket);
}
});
} catch (e) {
if (e is {{spec.title | caseUcfirst}}Exception) {
Expand Down

0 comments on commit a5decbf

Please sign in to comment.