Coder Social home page Coder Social logo

grpc_kit's Introduction

GrpcKit

Build Sttaus Gem Version

A kit for creating gRPC server/client in Ruby.

Installation

Add this line to your application's Gemfile:

gem 'grpc_kit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install grpc_kit

Usage

More Details in examples directory.

Server
sock = TCPServer.new(50051)
server = GrpcKit::Server.new
server.handle(GreeterServer.new)

loop do
  conn = sock.accept
  server.run(conn)
end
Client
sock = TCPSocket.new('localhost', 50051)
stub = Helloworld::Greeter::Stub.new(sock)
message = stub.say_hello(Helloworld::HelloRequest.new(name: 'your name')).message
puts message

Development

$ bundle install

Projects using grpc_kit

  • griffin Multi process gRPC server in Ruby

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cookpad/grpc_kit.

License

The gem is available as open source under the terms of the MIT License.

grpc_kit's People

Contributors

andrykonchin avatar eagletmt avatar eregon avatar ganmacs avatar kaorimatz avatar s4ichi avatar sorah avatar winebarrel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grpc_kit's Issues

Unbounded Client Streaming Bug (with repro)

Hi grpc_kit,

I've got a bug I can't debug myself. I ended up within the are of DS9 and couldn't figure out what was going on so I couldn't fix it myself.

Basically the issue I ran into was when client is streaming from an unending source it would just stop yielding messages at some point. It LOOKED like the socket stopped receiving data from what I could tell.

I've reproduced the problem (or similar) in the following git repo which has more notes. This is just a slightly hacked up routeguide so that it is unending. I'd expect it to never end, but the client starts missing messages and eventually it stops receiving all messages. This is over the course of minutes, not immediately.

https://github.com/brocktimus/grpc-kit-stream-repro

The server in this case also continue to stream, even when the client has disconnected. But I'm not as concerned about that one in my exact use case since I'm only streaming as a client and not a server.

Thanks, I really like the project. The forking server model for griffin looks fantastic.

Token-based authentication

Hi,
trying to replace grpc with grpc_kit to call regular grpc endpoint, I can call using grpc but after changing grpc_kit it has 'EOFError (EOF):' error. I thought that remote server closed connection because of applying credentials.

I coundn't find GRPC::Core::ChannelCredentials or related in grpc_kit, could you please advice ?

old code grpc , it works ;

creds = GRPC::Core::ChannelCredentials.new(nil, nil, nil)
stub = Com::VService::Speech::V1::Speech::Stub.new(SERVER, creds)
metadata = { authorization: "Bearer TokenX" , trackingid: '123'}
stub.get_recognize(req, metadata: metadata)

new with grpc_kit ( if I don't stringify_keys it raises cannot convert symbol to string error )

sock = TCPSocket.new('host.co', 443)
stub = Com::VService::Speech::V1::Speech::Stub.new(sock)
metadata = { authorization: "Bearer TokenX", trackingid: '123'}
stub.get_recognize(req, metadata: metadata.stringify_keys)

Exception handling?

Thank you for this light-weight alternative to grpc. I hope to be able to use it in production soon.

But first I need to ask you about exception handling. I don’t see anything mentioned in the Readme, and I find no uses of rescue in the examples/ folder. But when trying this gem out, I ended up getting a lot of GrpcKit::Session::ClientSession::ConnectionClosing exceptions. I am not sure if they are caused by the client session becoming “too old”, or if the client has gotten itself into a bad state, or something else.

Any help (and/or documentation) would be appreciated.

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.