Last active
August 6, 2021 11:34
-
-
Save percybolmer/e4474800d7e3cef7abc32437d06b46f3 to your computer and use it in GitHub Desktop.
Fulfilling PingPong interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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