All Projects → pahanini → go-grpc-bidirectional-streaming-example

pahanini / go-grpc-bidirectional-streaming-example

Licence: MIT License
gRPC bidirectional streaming example written in golang

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to go-grpc-bidirectional-streaming-example

Go Micro Boilerplate
The boilerplate of the GoLang application with a clear microservices architecture.
Stars: ✭ 147 (+77.11%)
Mutual labels:  example, grpc
Centrifugo
Scalable real-time messaging server in a language-agnostic way. Set up once and forever.
Stars: ✭ 5,649 (+6706.02%)
Mutual labels:  streaming, grpc
Go Grpc Examples
This repo contains examples and implementations of different types of GRPC services and APIs using Golang.
Stars: ✭ 180 (+116.87%)
Mutual labels:  example, grpc
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (+314.46%)
Mutual labels:  example, grpc
Swell
Swell: API development tool that enables developers to test endpoints served over streaming technologies including Server-Sent Events (SSE), WebSockets, HTTP2, GraphQL, and gRPC.
Stars: ✭ 517 (+522.89%)
Mutual labels:  streaming, grpc
Ultimate Go
This repo contains my notes on working with Go and computer systems.
Stars: ✭ 1,530 (+1743.37%)
Mutual labels:  example, grpc
openmgmt
Documentation and examples for using open network management tools such as OpenConfig
Stars: ✭ 23 (-72.29%)
Mutual labels:  streaming, grpc
liftbridge-api
Protobuf definitions for the Liftbridge gRPC API. https://github.com/liftbridge-io/liftbridge
Stars: ✭ 15 (-81.93%)
Mutual labels:  streaming, grpc
Akka Grpc
Akka gRPC
Stars: ✭ 361 (+334.94%)
Mutual labels:  streaming, grpc
Gb28181.solution
Linux/Win/Docker/kubernetes/Chart/Kustomize/GB28181/SIP/RTP/SDP/WebRTC/作为上下级域/平台级联互联
Stars: ✭ 323 (+289.16%)
Mutual labels:  streaming, grpc
Grpc Web Hacker News
An example app implementing a Hacker News reader in React with gRPC-Web and Go backend
Stars: ✭ 294 (+254.22%)
Mutual labels:  example, grpc
Liftbridge
Lightweight, fault-tolerant message streams.
Stars: ✭ 2,175 (+2520.48%)
Mutual labels:  streaming, grpc
waypoint-plugin-examples
An example repository that demonstrates how to create and run an external Waypoint plugin
Stars: ✭ 16 (-80.72%)
Mutual labels:  example, grpc
Cmakeprotosgrpc
gRPC + protobuf using CMake example
Stars: ✭ 137 (+65.06%)
Mutual labels:  example, grpc
Graphik
Graphik is a Backend as a Service implemented as an identity-aware document & graph database with support for gRPC and graphQL
Stars: ✭ 277 (+233.73%)
Mutual labels:  streaming, grpc
Flutter Grpc Tutorial
[Tutorial] Asynchronous Flutter chat client with Go chat server which are powered by gRPC (simple and streaming)
Stars: ✭ 167 (+101.2%)
Mutual labels:  streaming, grpc
Magiconion
Unified Realtime/API framework for .NET platform and Unity.
Stars: ✭ 2,505 (+2918.07%)
Mutual labels:  streaming, grpc
example cml
No description or website provided.
Stars: ✭ 21 (-74.7%)
Mutual labels:  example
ocaml-grpc-envoy
Using OCaml + gRPC via Envoy
Stars: ✭ 41 (-50.6%)
Mutual labels:  grpc
postcss-bidirection
PostCSS plugin that polyfill Bi-directional CSS properties and values to suppot rtl and ltr rules in all browsers
Stars: ✭ 24 (-71.08%)
Mutual labels:  bidirectional

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/[email protected]

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].