0.0
No release in over a year
Idiomatic Connect RPCs for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

connect-ruby

Idiomatic Connect RPCs for Ruby.

require "connect"
require_relative "ping_pb"

module Ping
  module V1
    module PingService
      class Client < ::Connect::Client
        self.service = "ping.v1.PingService"

        rpc :Ping, PingRequest, PingResponse
        rpc :PingStream, PingRequest, stream(PingResponse)
      end
    end
  end
end

client = Ping::V1::PingService::Client.new(
  transport: Connect::Transport.new(base_url: "http://localhost:8080")
)

response = client.ping(
  PingRequest.new(message: "Hello, world!")
)

puts response.message # => "Hello, world!"

response = client.ping_stream(
  PingRequest.new(message: "Hello, world!")
)

response.each do |message|
  puts message # => "Hello, world!"
end

Supported features

Note that this gem only supports HTTP/1.1. HTTP/2 is not supported.

Client

  • Unary (Request-Response) RPCs
  • Client streaming and server streaming RPCs
  • Bidirectional Streaming RPCs (not supported in HTTP/1.1)

Server

  • Unary (Request-Response) RPCs
  • Client streaming and server streaming RPCs
  • Bidirectional Streaming RPCs (not supported in HTTP/1.1)