Giter Club home page Giter Club logo

grpc-file-transfer's Introduction

gRPC Stream File Transfer Example

Simple example for file transfer using gRPC Stream.

  • Server: Go
  • Client: Dart

Dependencies:

  1. Go >= 1.5 - For install instructions Click Here

  2. Dart >= 2.2.2 <= 3.0.0 - For install instructions Click Here

  3. protoc (Protobuf Compiler) - For install instructions Click Here

  4. protoc-gen-go plugin

export GO111MODULE=on
go get github.com/golang/protobuf/protoc-gen-go
  1. protoc-gen-go-grpc plugin
export GO111MODULE=on
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
  1. protoc-gen-dart plugin
pub global activate protoc_plugin

Generating Protos

The last protos for this example already have been genereted and commited, but if you need to regenerate the protos use the instructions below:

Using vscode-proto3:

By default ⇧ + CTRL + P(Linux/Windows) ou ⇧ + ⌘ + P(Mac) opens the command prompt. Type one of these commands:

Command Description
proto3: Compile All Protos Compiles all workspace protos using configurations defined with protoc.options.
proto3: Compile This Proto Compiles the active proto using configurations defined with protoc.options.

This project has include .vscode/settings with necessary configs for vscode-proto3, open this file and uncomment "--plugin" parameters with absolute path for protoc-gen-dart, protoc-gen-go, protoc-gen-go-grpc case default configs doesn't works properly and get error with unknown path for this plugins.

Using protoc CLI:

Open terminal and cd for project root:

cd PROJECT_ROOT
protoc  --plugin="protoc-gen-go=[absolute_path_to]/protoc-gen-go" \
        --plugin="protoc-gen-go-grpc=[absolute_path_to]/protoc-gen-go-grpc" \
        --plugin="protoc-gen-dart=[absolute_path_to]/protoc-gen-dart" \
        --proto_path=${PWD} \
        --dart_out="grpc:./client/lib/src" \
        --go_out="./server" \
        --go-grpc_out="./server" \
        proto/grpc_file_transfer.proto

Try

  1. Run Server:
cd server/
go run main.go
  1. Run Client:
cd client/
dart --packages=.dart_tool/package_config.json package:grpcfiletransfer/src/client.dart

Credits

Video Example by File Examples

grpc-file-transfer's People

Contributors

feliperfmarques avatar

Stargazers

 avatar

Watchers

 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.