3
0
Fork 0
websocketd/tests/closing.cr

25 lines
390 B
Crystal
Raw Normal View History

2020-07-04 22:31:17 +02:00
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