Class: GrpcKit::Client
- Inherits:
-
Object
- Object
- GrpcKit::Client
- Defined in:
- lib/grpc_kit/client.rb
Instance Method Summary collapse
- #bidi_streamer(rpc, requests, opts = {}) ⇒ Object
- #client_streamer(rpc, opts = {}) ⇒ Object
-
#initialize(host, port, interceptors: [], timeout: nil) ⇒ Client
constructor
A new instance of Client.
- #request_response(rpc, request, opts = {}) ⇒ Object
- #server_streamer(rpc, request, opts = {}) ⇒ Object
Constructor Details
#initialize(host, port, interceptors: [], timeout: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/grpc_kit/client.rb', line 11 def initialize(host, port, interceptors: [], timeout: nil) @host = host @port = port @authority = "#{host}:#{port}" @interceptors = interceptors @timeout = if timeout GrpcKit::Session::Duration.from_numeric(timeout) else nil end end |
Instance Method Details
#bidi_streamer(rpc, requests, opts = {}) ⇒ Object
43 44 45 46 |
# File 'lib/grpc_kit/client.rb', line 43 def bidi_streamer(rpc, requests, opts = {}) rpc.config.interceptor.interceptors = @interceptors GrpcKit.logger.debug('Calling bidi_streamer') end |
#client_streamer(rpc, opts = {}) ⇒ Object
31 32 33 34 35 |
# File 'lib/grpc_kit/client.rb', line 31 def client_streamer(rpc, opts = {}) GrpcKit.logger.debug('Calling client_streamer') rpc.config.interceptor.interceptors = @interceptors do_request(rpc, nil, opts) end |