 I was trying your library and also have found that line 83 throw an exception because "resp" is nil when the websocket server is not available.  When i have commented that line, i could keep trying to connect to a wesocket server.