mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-02-11 20:43:29 +08:00
21 lines
570 B
Dart
21 lines
570 B
Dart
|
import 'package:starcitizen_doctor/common/grpc/grpc.dart';
|
||
|
import 'package:starcitizen_doctor/generated/grpc/app.pbgrpc.dart';
|
||
|
|
||
|
import '../common/utils/base_utils.dart';
|
||
|
|
||
|
class GrpcApi {
|
||
|
static final _pingClient = PingServiceClient(GrpcClient.channel);
|
||
|
|
||
|
static Future pingServer() async {
|
||
|
try {
|
||
|
final result = await _pingClient.pingServer(PingRequest(name: "ping"));
|
||
|
if (result.pong == "pong") {
|
||
|
dPrint("[GrpcApi] gRPC service Connected");
|
||
|
return;
|
||
|
}
|
||
|
} catch (e) {
|
||
|
dPrint("[GrpcApi] pingServer Error: $e");
|
||
|
}
|
||
|
}
|
||
|
}
|