GithubHelp home page GithubHelp logo

matiasinsaurralde / go-grpc-bidirectional-streaming-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pahanini/go-grpc-bidirectional-streaming-example

1.0 2.0 0.0 24 KB

gRPC bidirectional streaming example written in golang

License: MIT License

Makefile 7.49% Go 79.98% Shell 12.53%

go-grpc-bidirectional-streaming-example's Introduction

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 serever handle context errors (try to close client during send)

Requirements

  • go 1.12
  • protobuf installed
  • go support for protobuf installed

Installation

MacOS

brew install go
brew install protobuf
go get -u github.com/golang/protobuf/protoc-gen-go

Make sure protoc-gen-go added in PATH

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

go-grpc-bidirectional-streaming-example's People

Contributors

pahanini avatar matiasinsaurralde avatar dlintw avatar

Stargazers

hs.lucas.lee avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.