Git Product home page Git Product logo

grpc-streaming-example's Introduction

grpc-streaming-example

An example of gRPC streaming messages in Go.

Prerequisites

First, you need the Go programming language.

In addition, you need the protobuf, protoc-gen-go, and protoc-gen-go-grpc utilities.

You can install these on the Mac via brew:

  1. brew install go
  2. brew install protobuf
  3. brew install protoc-gen-go
  4. brew install protoc-gen-go-grpc

Compile

To compile the program, run make compile.

Run

Server

Run the server first.

$ ./server

The server will listen for a stream of people. For each received person, it will send an immediate message back and then send another message five seconds later.

To stop the server, press control + C.

Client

Then run the client.

$ ./client

The client will query details about a person from the console. Provide a name, location, and a number with spaces in between. E.g... halprin Internet 768

The client will then stream the person to the server five times with 10 seconds in between. In between these 10 seconds, you will receive both messages back from the server between sends.

After sending the person the fifth time, you will be able to type in details for another person like before.

To stop the client, press control + C or press return without providing any person details when the client is querying for a person.

grpc-streaming-example's People

Contributors

halprin 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.