Trying to create a timeout for grpc connection in the event that the server grpc implementation doesn't specify a callback function, however it seems that no matter what is specified in the options (new Date().getSeconds()+5) the client doesn't terminate the connection
function hello (call, callback) {
console.log(call.request.message)
}
server.addService(client.Hello.service, {hello: hello});
server.bind('localhost:50051', grpc.ServerCredentials.createInsecure());
server.start();
grpcClient = new client.Hello('localhost:50051',
grpc.credentials.createInsecure(),{deadline: new Date().getSeconds()+5}); //
grpcClient.hello({message: "abc"}, function(err, response) {
console.log(response) // doesn't reach here because function hello doesn't callback
})
via Stanley
No comments:
Post a Comment