require "option_parser" require "./test-ws" uri = "ws://localhost:1234/pong.JSON" OptionParser.parse do |parser| parser.on "-u uri", "--uri uri", "URI" do |opturi| uri = opturi end parser.on "-h", "--help", "Show this help" do puts parser exit 0 end end begin tws = TestWS.new uri puts "connection done: closing it" tws.close tws.read rescue e puts "Exception: #{e}" end