How to reconnect and resend request?
- Dominant language
- Dart
- Stars
- 1.1k
- Forks
- 419
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 8
Description
My code below,but I caught a ANR ,I want know the correct method to reconnect, thx.
```
_listen() async {
_channel.stream.listen((message) {
}, onError: (error) async {
Fluttertoast.showToast(msg: "onerror");
await Future.delayed(Duration(milliseconds: 1000));
reConnect();
}, onDone: () async {
Fluttertoast.showToast(msg: "ondone");
await Future.delayed(Duration(milliseconds: 1000));
reConnect();
});
}
void reConnect() {
print("reConnect------>IOWebSocketChannel");
_channel = IOWebSocketChannel.connect(Address.SOCKET_BASE_URL_RELEASE);
_channel.sink.add(getHistoryDealParam());
_channel.sink.add(getRealTimeDeal());
_listen();
}
```
@dart-lang
Contributor guide
Assessment
This issue has not been assessed yet.