Skip to content

Instantly share code, notes, and snippets.

@jasonsalas
Created August 16, 2021 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonsalas/2e0f675fb706400981f7202d36ad8c20 to your computer and use it in GitHub Desktop.
Save jasonsalas/2e0f675fb706400981f7202d36ad8c20 to your computer and use it in GitHub Desktop.
gRPC server-side streaming in Go - client application
package main
import (
"context"
"fmt"
"log"
"github.com/jasonsalas/protobank/internal/transaction"
"google.golang.org/grpc"
)
func main() {
fmt.Println("starting client")
conn, err := grpc.Dial(":50051", grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
log.Fatalln(err)
}
defer conn.Close()
txClient := transaction.NewClient(conn)
if err := txClient.Fetch(context.Background(), "ACC-1"); err != nil {
log.Fatalln(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment