Go Grpc Proto Server Client Basic Unary Streaming
Definisi
gRPC adalah RPC framework berbasis HTTP/2 dengan kontrak protobuf (.proto). Di Go, protoc + plugin go-grpc menghasilkan stub; server mengimplementasikan interface, client memanggil seperti fungsi lokal.
Kapan dipakai
Pakai untuk komunikasi antar-service internal (microservice) yang butuh performa tinggi & kontrak kuat. Hindari untuk publik browser (butuh grpc-web proxy) atau API publik sederhana (REST/JSON lebih mudah).
Cara kerja
Proto
syntax = "proto3";
package api;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
}