Skip to content
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

Node.js basics: Reader interface or Readable interface #883

Open
souris-dev opened this issue Oct 17, 2021 · 4 comments
Open

Node.js basics: Reader interface or Readable interface #883

souris-dev opened this issue Oct 17, 2021 · 4 comments

Comments

@souris-dev
Copy link

souris-dev commented Oct 17, 2021

While going through the docs for Node.js basics tutorial, I found a slight inconsistency.
Under the subsection "Implementing RouteGuide", it says the following under the listFeatures(call) function definition code:

As you can see, instead of getting the call object and callback in our method parameters, this time we get a call object that implements the Writable interface. In the method, we create as many Feature objects as we need to return, writing them to the call using its write() method. Finally, we call call.end() to indicate that we have sent all messages.

If you look at the client-side streaming method RecordRoute you’ll see it’s quite similar to the unary call, except this time the call parameter implements the Reader interface. The call’s 'data' event fires every time there is new data, and the 'end' event fires when all data has been read. Like the unary case, we respond by calling the callback...

In the first paragraph, the name of the interface is Writable, while in the second paragraph it is the Reader interface. For clarification, I looked at the example code referenced in this article, where the word Readable has been used.

Is Reader something separate, or is it just a minor inconsistency? If it's the latter, I would be happy to fix it (that is, if Readable was the intended name.)

@gnossen
Copy link
Collaborator

gnossen commented Oct 27, 2021

CC @murgatroid99

@murgatroid99
Copy link
Member

murgatroid99 commented Oct 27, 2021

Yes, it's supposed to be Readable. Specifically, this is referring to Node's built in stream.Writable and stream.Readable classes.

@ejona86
Copy link
Member

ejona86 commented Jun 22, 2022

@dfawley
Copy link
Member

dfawley commented Jul 27, 2022

Ping @murgatroid99

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

No branches or pull requests

5 participants