Class: RJR::NodeCallback
Overview
Node callback interface, used to invoke json-rpc methods against a remote node via node connection previously established
After a node sends a json-rpc request to another, the either node may send additional requests to each other via the connection already established until it is closed on either end
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ NodeCallback
constructor
NodeCallback initializer.
- #notify(callback_method, *data) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ NodeCallback
NodeCallback initializer
244 245 246 247 |
# File 'lib/rjr/node.rb', line 244 def initialize(args = {}) @node = args[:node] @connection = args[:connection] end |
Instance Method Details
#notify(callback_method, *data) ⇒ Object
249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/rjr/node.rb', line 249 def notify(callback_method, *data) # XXX return if node type does not support # pesistent conntections (throw err instead?) return if @node.class::RJR_NODE_TYPE == :web msg = NotificationMessage.new :method => callback_method, :args => data, :headers => @node. # TODO surround w/ begin/rescue block incase of socket errors / raise RJR::ConnectionError @node.send_msg msg.to_s, @connection end |