[NodeJS] Promises and async/await
It would be nice if there was a `grpc-tools` and/or `grpc_node_plugin` option that would generate client and server code that follows the ES6 Promise and ES7 async/await model. For example, instead of: https://github.com/grpc/grpc/blob/98f8989a6712118549c432c9f91b6a516250014d/examples/node/static_codegen/greeter_client.js#L35-L37 We could write: ``` [err, response] = await client.sayHello(request); ``` Or something similar. On the server side, instead of: https://github.com/grpc/grpc/blob/98f8989a6712118549c432c9f91b6a516250014d/examples/node/static_codegen/greeter_server.js#L27-L31 We could write: ``` async function sayHello(call) { var reply = new messages.HelloReply(); reply.setMessage('Hello ' + call.request.getName()); return [null, reply] } ``` Again, just ideas. This feature would eliminate the need for wrapper code for users wanting to use this pattern. I would love to know if anyone is interested in this feature or planning on adding it. Thanks! (moved from https://github.com/grpc/grpc/issues/12751)
Posted by alexkreidler on Sep 29, 2017, 9:24 PM
Tags
Related issues
- Custom games stuck on "finding server" for all european servers
- Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
- Forza Horizon 6 (2483190)
- Turn off integrated browser for default
- Weekly updates are too frequent
- [BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments
github (Sysadmin)
Custom games stuck on "finding server" for all european servers
Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
Forza Horizon 6 (2483190)
Turn off integrated browser for default
Weekly updates are too frequent
[BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Add gemini-3.1-pro-preview
[TF2] Feature request: Bring Back Quickplay
[NodeJS] Promises and async/await
It would be nice if there was a `grpc-tools` and/or `grpc_node_plugin` option that would generate client and server code that follows the ES6 Promise and ES7 async/await model. For example, instead of: https://github.com/grpc/grpc/blob/98f8989a6712118549c432c9f91b6a516250014d/examples/node/static_codegen/greeter_client.js#L35-L37 We could write: ``` [err, response] = await client.sayHello(request); ``` Or something similar. On the server side, instead of: https://github.com/grpc/grpc/blob/98f8989a6712118549c432c9f91b6a516250014d/examples/node/static_codegen/greeter_server.js#L27-L31 We could write: ``` async function sayHello(call) { var reply = new messages.HelloReply(); reply.setMessage('Hello ' + call.request.getName()); return [null, reply] } ``` Again, just ideas. This feature would eliminate the need for wrapper code for users wanting to use this pattern. I would love to know if anyone is interested in this feature or planning on adding it. Thanks! (moved from https://github.com/grpc/grpc/issues/12751)
Comments (0)
No comments yet. Start the discussion.