diff --git a/grpc/ruby_client/helloworld_client.rb b/grpc/ruby_client/helloworld_client.rb new file mode 100644 index 0000000..3721fc1 --- /dev/null +++ b/grpc/ruby_client/helloworld_client.rb @@ -0,0 +1,14 @@ +require 'grpc' +require './proto/helloworld_services_pb' + +include Sample + +def main + stub = Greeter::Stub.new('127.0.0.1:5502', :this_channel_is_insecure) + + hello_request = HelloRequest.new(first_name: "Roger", last_name: "Federer") + hello_reply = stub.say_hello(hello_request) + puts hello_reply.message +end + +main diff --git a/grpc/ruby_client/notification_client.rb b/grpc/ruby_client/notification_client.rb new file mode 100644 index 0000000..8e819e0 --- /dev/null +++ b/grpc/ruby_client/notification_client.rb @@ -0,0 +1,16 @@ +require 'grpc' +require './proto/notification_services_pb' + +include Sample + +def main + stub = Notifier::Stub.new('127.0.0.1:5502', :this_channel_is_insecure) + + pereodic_hello_request = PereodicHelloRequest.new(first_name: "Roger", last_name: "Federer") + resp = stub.pereodic_hello(pereodic_hello_request) + resp.each do |r| + puts r.message + end +end + +main diff --git a/grpc/ruby_client/proto/helloworld_services_pb.rb b/grpc/ruby_client/proto/helloworld_services_pb.rb index 583dbf5..873dbf8 100644 --- a/grpc/ruby_client/proto/helloworld_services_pb.rb +++ b/grpc/ruby_client/proto/helloworld_services_pb.rb @@ -2,7 +2,7 @@ # Source: proto/helloworld.proto for package 'sample' require 'grpc' -require 'proto/helloworld_pb' +require './proto/helloworld_pb' module Sample module Greeter diff --git a/grpc/ruby_client/proto/notification_pb.rb b/grpc/ruby_client/proto/notification_pb.rb index 42c68f8..4786178 100644 --- a/grpc/ruby_client/proto/notification_pb.rb +++ b/grpc/ruby_client/proto/notification_pb.rb @@ -16,6 +16,6 @@ end module Sample - PereodicHelloRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sample.PereodicHelloRequest").msgclass - PeriodicHelloReply = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sample.PeriodicHelloReply").msgclass + PereodicHelloRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("sample.PereodicHelloRequest").msgclass + PeriodicHelloReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("sample.PeriodicHelloReply").msgclass end diff --git a/grpc/ruby_client/proto/notification_services_pb.rb b/grpc/ruby_client/proto/notification_services_pb.rb index 17cdc0e..183a217 100644 --- a/grpc/ruby_client/proto/notification_services_pb.rb +++ b/grpc/ruby_client/proto/notification_services_pb.rb @@ -2,7 +2,7 @@ # Source: proto/notification.proto for package 'sample' require 'grpc' -require 'proto/notification_pb' +require './proto/notification_pb' module Sample module Notifier