Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Created December 31, 2019 02:39
Show Gist options
  • Save gistlyn/4336525e149ea2788bbf392d984fb060 to your computer and use it in GitHub Desktop.
Save gistlyn/4336525e149ea2788bbf392d984fb060 to your computer and use it in GitHub Desktop.
Ruby Google protoc SSL GrpcServices Client TodoWorld Example
#!/usr/bin/env ruby
this_dir = File.expand_path(File.dirname(__FILE__))
lib_dir = File.join(this_dir, 'lib')
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
require 'grpc'
require 'services_pb'
require 'services_services_pb'
def main
credentials = GRPC::Core::ChannelCredentials.new(File.read('grpc.crt'))
client = GrpcServices::Stub.new('todoworld.servicestack.net:50051', credentials)
response = client.get_hello(Hello.new(Name:'gRPC Ruby'))
puts response.Result
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment