Skip to content

Support more gRPC streaming events. #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 9, 2016
Merged

Conversation

jmuk
Copy link
Contributor

@jmuk jmuk commented Nov 8, 2016

  • 'metadata' and 'status' events are meaningful and should be
    forwarded.
  • gRPC streaming results have 'cancel' method, this method call
    needs to be forwarded as well.

Fixes #67

jmuk added 2 commits November 8, 2016 13:50
- 'metadata' and 'status' events are meaningful and should be
  forwarded.
- gRPC streaming results have 'cancel' method, this method call
  needs to be forwarded as well.

Fixes googleapis#67
@codecov-io
Copy link

codecov-io commented Nov 8, 2016

Current coverage is 92.23% (diff: 83.33%)

Merging #68 into master will decrease coverage by 0.01%

@@             master        #68   diff @@
==========================================
  Files             9          9          
  Lines           993       1004    +11   
  Methods         148        151     +3   
  Messages          0          0          
  Branches        210        212     +2   
==========================================
+ Hits            916        926    +10   
- Misses           77         78     +1   
  Partials          0          0          

Powered by Codecov. Last update 02e88b3...826f4e6

@jmuk
Copy link
Contributor Author

jmuk commented Nov 8, 2016

@geigerj @bjwatson -- can you take a look at this? I'm afraid that @landrito would not have much time to review this.

if (this.type !== StreamType.CLIENT_STREAMING) {
stream.on('data', this.emit.bind(this, 'data'));
// Pushing null causes an ending process of the readable stream.
stream.on('end', this.push.bind(this, null));
// This is required in case there's no 'data' handler exists.

This comment was marked as spam.

This comment was marked as spam.

stream.on(event, this.emit.bind(this, event));
}.bind(this));
// We also want to supply the status data as 'response'.
stream.on('status', this.emit.bind(this, 'response'));

This comment was marked as spam.

This comment was marked as spam.

if (this.type !== StreamType.CLIENT_STREAMING) {
stream.on('data', this.emit.bind(this, 'data'));
// Pushing null causes an ending process of the readable stream.
stream.on('end', this.push.bind(this, null));
// This is required in case there's no 'data' handler exists.
this.resume();

This comment was marked as spam.

This comment was marked as spam.

@jmuk jmuk merged commit 07f78f8 into googleapis:master Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants