Created
May 10, 2017 17:24
-
-
Save marshallbrekka/382e18317df71801b06e003ac227b79a to your computer and use it in GitHub Desktop.
greeter_client.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 'helloworld_services_pb' | |
def main | |
sleep(15) | |
stub = Helloworld::Greeter::Stub.new(ENV["GRPC_TARGET"] || 'localhost:50051', :this_channel_is_insecure) | |
message = stub.say_hello(Helloworld::HelloRequest.new(name: "username"), {metadata: {"foo":"bar"}}).message | |
puts "Greeting: #{message}" | |
sleep(15) | |
message = stub.say_hello(Helloworld::HelloRequest.new(name: "username"), {metadata: {"foo":"bar"}}).message | |
puts "Greeting: #{message}" | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment