Created
August 16, 2021 18:59
-
-
Save jasonsalas/2e0f675fb706400981f7202d36ad8c20 to your computer and use it in GitHub Desktop.
gRPC server-side streaming in Go - client application
This file contains hidden or 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" | |
"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