async def ServerStreamingEchoAbort(self, request, context): for _ in range(request.message_count // 2): yield echo_pb2.EchoResponse(message=request.message) context.set_code(grpc.StatusCode.ABORTED)
async def ServerStreamingEcho(self, request, context): for _ in range(request.message_count): yield echo_pb2.EchoResponse(message=request.message) await asyncio.sleep(request.message_interval.seconds / 2) time.sleep(request.message_interval.seconds / 2)
async def Echo(self, request, context): return echo_pb2.EchoResponse(message=request.message)
async def EchoAbort(self, request, context): context.set_code(grpc.StatusCode.ABORTED) return echo_pb2.EchoResponse(message=request.message)
def ServerStreamingEcho(self, request, context): for _ in range(request.message_count): yield echo_pb2.EchoResponse(message=request.message)