class KRPC::RPCConnection

TCP connection for sending RPC calls and retrieving its results.

Attributes

client_id[R]
name[R]

Public Class Methods

new(name = Client::DEFAULT_NAME, host = DEFAULT_SERVER_HOST, port = DEFAULT_SERVER_RPC_PORT) click to toggle source
Calls superclass method KRPC::Connection::new
# File lib/krpc/connection.rb, line 92
def initialize(name = Client::DEFAULT_NAME, host = DEFAULT_SERVER_HOST, port = DEFAULT_SERVER_RPC_PORT)
  super host, port
  @name = name
end

Public Instance Methods

cleanup() click to toggle source
# File lib/krpc/connection.rb, line 103
def cleanup
  @client_id = nil
end
handshake() click to toggle source

Perform handshake with kRPC server, obtaining @client_id.

# File lib/krpc/connection.rb, line 98
def handshake
  resp = protobuf_handshake(:RPC, client_name: name)
  @client_id = resp.client_identifier
end