mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 14:43:43 +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");
|
|
}
|
|
}
|
|
}
|