All Projects → rfyiamcool → Grpcall

rfyiamcool / Grpcall

🦀 Easy request GRPC Server with reflect mode

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Grpcall

Thingsboard
Open-source IoT Platform - Device management, data collection, processing and visualization.
Stars: ✭ 10,526 (+11097.87%)
Mutual labels:  grpc
Php Zipkin Demo
Laravel + go-micro + grpc + Zipkin
Stars: ✭ 74 (-21.28%)
Mutual labels:  grpc
Docker Cloud Platform
使用Docker构建云平台,Docker云平台系列共三讲,Docker基础、Docker进阶、基于Docker的云平台方案。OpenStack+Docker+RestAPI+OAuth/HMAC+RabbitMQ/ZMQ+OpenResty/HAProxy/Nginx/APIGateway+Bootstrap/AngularJS+Ansible+K8S/Mesos/Marathon构建/探索微服务最佳实践。
Stars: ✭ 86 (-8.51%)
Mutual labels:  grpc
Libra Grpc
A lightweight JavaScript library for Libra
Stars: ✭ 69 (-26.6%)
Mutual labels:  grpc
Drachtio Freeswitch Modules
A collection of open-sourced freeswitch modules that I use in various drachtio applications
Stars: ✭ 73 (-22.34%)
Mutual labels:  grpc
Charon
Authorization and authentication service.
Stars: ✭ 79 (-15.96%)
Mutual labels:  grpc
App
Reusable framework for micro services & command line tools
Stars: ✭ 66 (-29.79%)
Mutual labels:  grpc
Csi Test
CSI test frameworks
Stars: ✭ 90 (-4.26%)
Mutual labels:  grpc
Our pc
Our Procedure Calls
Stars: ✭ 73 (-22.34%)
Mutual labels:  grpc
Lile
Easily generate gRPC services in Go ⚡️
Stars: ✭ 1,271 (+1252.13%)
Mutual labels:  grpc
Guard
GRPC Wireguard Server to manage tunnels
Stars: ✭ 71 (-24.47%)
Mutual labels:  grpc
Grpc Demos
Demos for my talk Beyond HTTP in ASP.NET Core 3.0 with gRPC
Stars: ✭ 74 (-21.28%)
Mutual labels:  grpc
Flyte
Accelerate your ML and Data workflows to production. Flyte is a production grade orchestration system for your Data and ML workloads. It has been battle tested at Lyft, Spotify, freenome and others and truly open-source.
Stars: ✭ 1,242 (+1221.28%)
Mutual labels:  grpc
Koatty
Koa2 + Typescript = Koatty. Use Typescript's decorator implement IOC and AOP.
Stars: ✭ 67 (-28.72%)
Mutual labels:  grpc
Grpc Swift
The Swift language implementation of gRPC.
Stars: ✭ 1,270 (+1251.06%)
Mutual labels:  grpc
Grpc Auth Example
Examples of client authentication with gRPC
Stars: ✭ 65 (-30.85%)
Mutual labels:  grpc
Grpcdump
Tool for capture and parse grpc traffic
Stars: ✭ 75 (-20.21%)
Mutual labels:  grpc
Grpc Rs
The gRPC library for Rust built on C Core library and futures
Stars: ✭ 1,306 (+1289.36%)
Mutual labels:  grpc
Dgraph Rs
A dgraph client driver written in rust ⛺
Stars: ✭ 89 (-5.32%)
Mutual labels:  grpc
Grpcweb Example
An example implementation of a GopherJS client and a Go server using the Improbable gRPC-Web implementation
Stars: ✭ 85 (-9.57%)
Mutual labels:  grpc

grpcall

grpcall is a client library easy request GRPC Server with reflect mode, then it make grpc proxy mode middleware, like grpc-gateway.

use GRPC's reflect mode to request GRPC Server. grpcall support FileDescriptorSet and grpc/reflection mode.

some code refer: protoreflect, grpcurl

Feature

  • support event hook
  • dynamic request GRPC Server with reflect mode.
  • dynamic convert protobuf to json and json to protobuf
  • grpc client manager
  • support stream
  • recv system signal to update new descriptor.
  • ...

Usage

grpcall.SetProtoSetFiles("helloworld.protoset")
grpcall.InitDescSource()

var handler = DefaultEventHandler{}
var sendBody string

grpcEnter, err := grpcall.New(
    grpcall.SetHookHandler(&handler),
)
grpcEnter.Init()

sendBody = `{"name": "xiaorui.cc"}`
res, err := grpcEnter.Call("127.0.0.1:50051", "helloworld.Greeter", "SayHello", sendBody)
fmt.Printf("%+v \n", res)
fmt.Println("req/reply return err: ", err)

sendBody = `{"msg": "hehe world"}`
res, err = grpcEnter.Call("127.0.0.1:50051", "helloworld.SimpleService", "SimpleRPC", sendBody)
fmt.Printf("%+v \n", res)
fmt.Println("stream return err: ", err)

wg := sync.WaitGroup{}
wg.Add(2)

go func() {
    defer wg.Done()
    for {
        body := fmt.Sprintf(`{"msg": "hehe world %s"}`, time.Now().String())
        select {
        case res.SendChan <- []byte(body):
            // fmt.Println("send", body)
            time.Sleep(3 * time.Second)

        case <-res.DoneChan:
            return

        default:
            return
        }
    }
}()

go func() {
    defer wg.Done()

    for {
        select {
        case msg, ok := <-res.ResultChan:
            fmt.Println("recv data:", msg, ok)
        case err := <-res.DoneChan:
            fmt.Println("done chan: ", err)
            return
        }
    }
}()

wg.Wait()

type DefaultEventHandler struct {
    sendChan chan []byte
}

func (h *DefaultEventHandler) OnReceiveData(md metadata.MD, resp string, respErr error) {
}

func (h *DefaultEventHandler) OnReceiveTrailers(stat *status.Status, md metadata.MD) {
}

Test Example

  1. start grpc server
cd testing; go run test_server.go
  1. start grpcall client
cd testing; go run test_grpcall_client.go

Protoset Files

Protoset files contain binary encoded google.protobuf.FileDescriptorSet protos. To create a protoset file, invoke protoc with the *.proto files that define the service:

protoc --proto_path=. \
    --descriptor_set_out=myservice.protoset \
    --include_imports \
    my/custom/server/service.proto
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].