The server streaming API
Important note
In terms of the underlying protocol, the server streaming API uses Send Header
followed by Send Message
and Half-Close
from the client side, and multiple Send Message
plus Send Trailer
from the server side.
Now, that we know how to register a service, interact with a “database,” and run our client and server, everything will be faster. We will focus mostly on the API endpoint itself. In our case, we are going to create a ListTasks
endpoint, which, as its name suggests, lists all the available tasks in the database.
One thing that we are going to do to make this a little bit fancier is that for each task listed, we are going to return whether this task is overdue or not. This is mostly done so that you can see how to provide more information about a certain object in the response
object.
So, in the todo.proto
file, we are going to add an RPC endpoint called ListTasks
, which will take ListTasksRequest
and return a stream...