Skip to content

gRPC implemented with Go server and Flutter client

Notifications You must be signed in to change notification settings

dnys1/grpc_demo

Repository files navigation

gRPC Demo

Demonstration of the gRPC protocol with a Go server and a Flutter client.

Why gRPC?

gRPC is an alternative to HTTP-JSON which sends structured binary data over HTTP/2 instead of plaintext JSON, resulting in performance increases and more portable models. This is accomplished through the use of Protocol Buffers for model development.

gRPC

Running the Demo

Start Server

To start the server:

docker-compose up

This will launch the gRPC server as well as the Envoy proxy required to run the demo on Flutter Web (explained below).

Start Client

To start the client:

cd client && flutter run

Running on a Device

In order to run the Flutter demo on a device (instead of a simulator), you must use ngrok to tunnel the TCP traffic (requires a free ngrok account).

ngrok tcp 50051

ngrok output

After running this command, you'll need to copy the Forwarding address to client/lib/core/config/config.dart (lines 13 and 24). For Flutter Web, the port is always 8080 because its traffic is routed through the Envoy proxy.

Running on the Web

In order to use gRPC on the web, the grpc-web library is used. Currently, only unary and server-side streaming are supported. Moreover, an intermediate proxy is required to convert HTTP/2 requests and responses to HTTP/1 for the browser. For more information, see this blog post.

grpc-web

About

gRPC implemented with Go server and Flutter client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published