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
261 262 263 264 |
# File 'lib/rjr/node.rb', line 261 def initialize(args = {}) @node = args[:node] @connection = args[:connection] end |
Instance Method Details
#notify(callback_method, *data) ⇒ Object
266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/rjr/node.rb', line 266 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 |