grpc

Catalogue
  1. 1. @build
  2. 2. @method grpc 调用

@build

1
2
3
> cd pkg/grpc/bin
> sh gen.sh
.......

@method grpc 调用

组件封装有连接池机制,复用多个连接

1
2
3
4
5
6
7
8
9
10
use Grpc\Client\GrpcLogicClient;
use Im\Cloud\Operation;
use Im\Logic\HeartbeatReq;

$heartBeatReq = new HeartbeatReq();
$host = env("APP_HOST","127.0.0.1").":".env("GRPC_PORT",9500);
$heartBeatReq->setServer($host);
$heartBeatReq->setKey($key);
$heartBeatReq->setMid($mid);
GrpcLogicClient::Heartbeat($grpcServer,$heartBeatReq);