Skip to content

API 参考 / @142vip/grpc / grpcStreamHandler

函数: grpcStreamHandler() ​

grpcStreamHandler(methodType, methodFunc): (<RequestType, ResponseType>(call, callback) => void) | (<RequestType, ResponseType>(call) => Promise<void>) | (<RequestType, ResponseType>(call) => void)

定义于: core/grpc.handler.ts:45

处理GRPC流式调用,返回流对象

参数 ​

methodType ​

Omit<ServiceMethodType, "unary">

methodFunc ​

ServiceMethodFuncImpl

返回 ​

函数 ​

<RequestType, ResponseType>(call, callback) => void

客户端流

类型参数 ​

RequestType ​

RequestType extends GrpcRequest

ResponseType ​

ResponseType

参数 ​

call ​

ServerReadableStream<RequestType, ResponseType>

callback ​

sendUnaryData<GrpcResponse<ResponseType>>

返回 ​

void


函数 ​

<RequestType, ResponseType>(call) => Promise<void>

服务端流

类型参数 ​

RequestType ​

RequestType extends GrpcRequest

ResponseType ​

ResponseType

参数 ​

call ​

ServerWritableStream<RequestType, GrpcResponse<ResponseType>>

返回 ​

Promise<void>


函数 ​

<RequestType, ResponseType>(call) => void

客户端、服务端,流式

类型参数 ​

RequestType ​

RequestType extends GrpcRequest

ResponseType ​

ResponseType

参数 ​

call ​

ServerDuplexStream<RequestType, GrpcResponse<ResponseType>>

返回 ​

void