Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 11:34
Show Gist options
  • Save percybolmer/e4474800d7e3cef7abc32437d06b46f3 to your computer and use it in GitHub Desktop.
Save percybolmer/e4474800d7e3cef7abc32437d06b46f3 to your computer and use it in GitHub Desktop.
Fulfilling PingPong interface
package main
import (
"context"
pingpong "github.com/percybolmer/grpcexample/pingpong"
)
// Server is the Logic handler for the server
// It has to fullfill the GRPC schema generated Interface
// In this case its only 1 function called Ping
type Server struct {
pingpong.UnimplementedPingPongServer
}
// Ping fullfills the requirement for PingPong Server interface
func (s *Server) Ping(ctx context.Context, ping *pingpong.PingRequest) (*pingpong.PongResponse, error) {
return &pingpong.PongResponse{
Ok: true,
}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment