Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/datadog/go-grpc-bidirectional-streaming-example

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/datadog/go-grpc-bidirectional-streaming-example

  • v0.0.0-20221024060302-b9cf785c02fe
  • Source
  • Go
  • Socket score

Version published
Created
Source

Golang gRPC bidirectional streaming example

  • client sends random numbers to server
  • server receives number and sends it back if the number greater than all previous numbers
  • both client and server handle context errors (try to close client during send)

Requirements

  • go 1.17.1
  • protobuf installed
  • go support for protobuf installed

Installation

MacOS

brew install go
brew install protobuf
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1

Make sure protoc-gen-go added in PATH

To add it to PATH you can use bash profile for example.

Edit vim ~/.bash_profile, add: export PATH="$PATH:$(go env GOPATH)/bin", run source ~/.bash_profile to apply changes.

Linux

TBD

Complie

make all

It should create two binaries server and client

Use

Start server ./server and in other terminal start ./client

Client output example:

./client
2017/12/01 14:16:54 0 sent
2017/12/01 14:16:54 1 sent
2017/12/01 14:16:54 new max 1 received
2017/12/01 14:16:55 2 sent
2017/12/01 14:16:55 new max 2 received
2017/12/01 14:16:55 0 sent
2017/12/01 14:16:55 0 sent
2017/12/01 14:16:55 4 sent
2017/12/01 14:16:55 new max 4 received
2017/12/01 14:16:55 0 sent
2017/12/01 14:16:56 6 sent
2017/12/01 14:16:56 new max 6 received
2017/12/01 14:16:56 3 sent
2017/12/01 14:16:56 2 sent
2017/12/01 14:16:56 finished with max=6

Server output:

./server
2017/12/01 14:16:54 start new server
2017/12/01 14:16:54 send new max=1
2017/12/01 14:16:55 send new max=2
2017/12/01 14:16:55 send new max=4
2017/12/01 14:16:56 send new max=6
2017/12/01 14:16:56 exit

FAQs

Package last updated on 24 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc