app/lib/api/grpc_api.dart
2023-12-02 12:26:17 +08:00

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");
}
}
}