Class: Eth::Client::Ipc
- Inherits:
-
Eth::Client
- Object
- Eth::Client
- Eth::Client::Ipc
- Defined in:
- lib/eth/client/ipc.rb
Overview
Provides an IPC-RPC client.
Instance Attribute Summary collapse
-
#path ⇒ Object
The path of the IPC socket.
Instance Method Summary collapse
-
#initialize(path) ⇒ Ipc
constructor
Constructor for the IPC Client.
-
#send_request(payload) ⇒ String
Sends an RPC request to the connected IPC socket.
Constructor Details
#initialize(path) ⇒ Ipc
Constructor for the IPC Client. Should not be used; use Eth::Client.create instead.
30 31 32 33 |
# File 'lib/eth/client/ipc.rb', line 30 def initialize(path) super @path = path end |
Instance Attribute Details
#path ⇒ Object
The path of the IPC socket.
24 25 26 |
# File 'lib/eth/client/ipc.rb', line 24 def path @path end |
Instance Method Details
#send_request(payload) ⇒ String
Sends an RPC request to the connected IPC socket.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/eth/client/ipc.rb', line 39 def send_request(payload) socket = UNIXSocket.new(@path) socket.puts(payload) read = socket.recvmsg(nil)[0] until read.end_with?("\n") read = read << socket.recvmsg(nil)[0] end socket.close return read end |