New npm module: Promisify grpc client for NodeJS for all Request types (standard and stream)

327 views
Skip to first unread message

Carles Sistaré

unread,
May 3, 2017, 7:50:57 AM5/3/17
to grpc.io
My pleasure to introduce you this new npm module for promisifying all client requests in Node

Cheers

Michael Lumish

unread,
May 3, 2017, 2:33:17 PM5/3/17
to Carles Sistaré, grpc.io
I think this is an interesting library, but I had a couple of concerns about the API, particularly regarding streaming requests. First, I noticed that in your server streaming example, the response messages appear to be coalesced into an array before being returned to the user, which seems to negate two major advantages that would lead someone to use streaming responses in the first place: providing the ability to handle responses as they are generated by the server, and avoiding the need to keep all responses in memory simultaneously. For example, one use of streaming responses could be for video streaming, where each response is a small chunk of video data. Holding all of the data until the end of the call would essentially turn a video stream into a video download.

I also noticed that the bidirectional streaming section had this caveat: "In order to keep track of the messages sent and to be able to callback all the requests, the server implementation needs to answer with the same id received". This makes it sound like your API only supports bidirectional streams with a 1-to-1 mapping of requests to responses, which would be a major restriction of general bidirectional streaming semantics. Does that mean that your bidirectional streaming API requires request and response messages to contain an integer id field, and that that id field is only used to store the message sequence number within a single stream?

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/9581baae-f9c0-434c-9cd7-713bf4844ebc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dbo...@gmail.com

unread,
May 3, 2017, 4:21:25 PM5/3/17
to grpc.io
Interesting! I had made a similar in concept module a little while ago, but different form of usage / API.


There might be some room for improvement I think that I'll get to soon hopefully, but it works heh. :)

Carles Sistaré

unread,
May 5, 2017, 6:12:14 AM5/5/17
to Michael Lumish, grpc.io
Yes indeed, from streaming purposes such as video that would not be possible at the moment.
This first release was thought for streaming applications with 1-to-1 mapping of request-responses, in order to take advantage of the open connection and the low bandwidth comparing to a classic http connection. In my company it has become a very useful asset.
I am already thinking on another implementation of this "promise/functional_programing" method for real streaming communications, in order to avoid listening to 'data' events.
If you have any ideas in mind, would you let me know?
I'll keep you posted as soon as something new comes up.
Reply all
Reply to author
Forward
0 new messages