grpc-dart
grpc-dart copied to clipboard
Hang the call when internet is interrupted
I am using grpc-dart on Flutter and I am facing a problem on the iOS but it works on Android and web, when the internet is interrupted, the call from client have never returned or thrown any errors.
grpc: ^3.0.0
Repro steps
- Run flutter app is using grpc on iOS
- Disconnecting the internet
- create a call from grpc client
Expected result: return or throw any errors
Actual result: the client call hang over
My workaround
import 'package:http/http.dart' as http;
import 'dart:io' show Platform;
Future<ClientConnection> getConnection() async {
if (_isShutdown) throw GrpcError.unavailable('Channel shutting down.');
if (!_connected) {
_connection = createConnection();
_connected = true;
}
if (Platform.isIOS) {
await http.get(Uri.parse('http://example.com/'));
}
return _connection;
}
Just to clarify: does the network go down during a gRPC call and you don't get any error or it just goes down before the call and you don't get any error? I guess it is the second one based on your reproduction steps.
the internet goes down before the call. Then when I connected internet, these calls are sent to server.
I have a same problem, are there any updates?
me too