class XRBP::WebSocket::Plugins::ResultParser

Plugin to automatically parse and convert websocket results, before returning.

@example parse json

connection = WebClient::Connection.new "wss://s1.ripple.com:443"
connection.add_plugin :command_dispatcher, :result_parser

connection.parse_results do |res|
  JSON.parse(res)
end

puts connection.cmd(WebSocket::Cmds::ServerInfo.new)["result"]["info"]["build_version"]

Public Instance Methods

parser=(p) click to toggle source
Calls superclass method
# File lib/xrbp/websocket/plugins/result_parser.rb, line 17
def parser=(p)
  super(p)

  self.connection.connections.each { |conn|
    conn.parse_results &p
  } if self.connection.kind_of?(MultiConnection)

  p
end