DEV Community

Discussion on: Part-2: Building a basic microservice with unidirectional-streaming gRPC using Golang

Collapse
 
helicopterinhand profile image
Russell

Hi Toran, thanks so much for this tutorial!!

I am quite new to gRPC and have a few questions.

  1. For the ServerStreamingExecute function, let's say the stream.Send has an error and I want to handle it. Should I just log.Print it or should I return an error in the response?

  2. Also for the ServerStreamingExecute function, the second argument it accepts stream is a type interface rather than type struct. The interface is called
    Machine_ServerStreamingExecuteServer
    while the struct is called
    machineServerStreamingExecuteServer.
    Why do we have to use the type interface here?