{"action":"created","issue":{"url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/3","labels_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/3/comments","events_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/3/events","html_url":"https://github.com/TakahikoKawasaki/nv-websocket-client/issues/3","id":91137116,"number":3,"title":"Reconnect Socket","user":{"login":"AngellusMortis","id":490848,"avatar_url":"https://avatars.githubusercontent.com/u/490848?v=3","gravatar_id":"","url":"https://api.github.com/users/AngellusMortis","html_url":"https://github.com/AngellusMortis","followers_url":"https://api.github.com/users/AngellusMortis/followers","following_url":"https://api.github.com/users/AngellusMortis/following{/other_user}","gists_url":"https://api.github.com/users/AngellusMortis/gists{/gist_id}","starred_url":"https://api.github.com/users/AngellusMortis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngellusMortis/subscriptions","organizations_url":"https://api.github.com/users/AngellusMortis/orgs","repos_url":"https://api.github.com/users/AngellusMortis/repos","events_url":"https://api.github.com/users/AngellusMortis/events{/privacy}","received_events_url":"https://api.github.com/users/AngellusMortis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-26T03:02:57Z","updated_at":"2015-06-26T04:23:32Z","closed_at":null,"body":"I have been going through the code looking for a way to reconnect a socket with no luck. I tried to simply run `.connect()` again on an interval until the connection went through, but I had no luck. It will just keep throwing a WebSocketExpection everytime I try to use `.connect()`. This is what I tried:\r\n\r\n    @Override\r\n    public void onDisconnected(WebSocket socket, WebSocketFrame serverCloseFrame,\r\n                               WebSocketFrame clientCloseFrame, boolean closedByServer) {\r\n        if (!closedByServer) {\r\n            RSMCPlugin.Instance.getLogger().warning(\"Socket disconnected. Will try every 3 seconds until successful\");\r\n            this.tryReconnect(socket);\r\n        }\r\n    }\r\n\r\n    private void tryReconnect(WebSocket socket) {\r\n        try {\r\n            Thread.sleep(3000);\r\n            socket.connect();\r\n        }\r\n        catch (InterruptedException e) {\r\n            Thread.currentThread().interrupt();\r\n        }\r\n        catch (WebSocketException e) {\r\n            this.tryReconnect(socket);\r\n        }\r\n    }\r\n\r\nI am using version 1.5 from Maven. \r\n\r\nIs this a bug? Is not, can you please update the documentation to show the proper way to attempt reconnecting. \r\n\r\nAlso, you library is the only one I have been able to find that works on my WSS server. I am not sure why, but great job!"},"comment":{"url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/comments/115496318","html_url":"https://github.com/TakahikoKawasaki/nv-websocket-client/issues/3#issuecomment-115496318","issue_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/3","id":115496318,"user":{"login":"TakahikoKawasaki","id":1641166,"avatar_url":"https://avatars.githubusercontent.com/u/1641166?v=3","gravatar_id":"","url":"https://api.github.com/users/TakahikoKawasaki","html_url":"https://github.com/TakahikoKawasaki","followers_url":"https://api.github.com/users/TakahikoKawasaki/followers","following_url":"https://api.github.com/users/TakahikoKawasaki/following{/other_user}","gists_url":"https://api.github.com/users/TakahikoKawasaki/gists{/gist_id}","starred_url":"https://api.github.com/users/TakahikoKawasaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TakahikoKawasaki/subscriptions","organizations_url":"https://api.github.com/users/TakahikoKawasaki/orgs","repos_url":"https://api.github.com/users/TakahikoKawasaki/repos","events_url":"https://api.github.com/users/TakahikoKawasaki/events{/privacy}","received_events_url":"https://api.github.com/users/TakahikoKawasaki/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T04:23:32Z","updated_at":"2015-06-26T04:23:32Z","body":"Thank you for using nv-websocket-client.\r\n\r\nThe behavior you described is not a bug. It's intended behavior. WebSocket.connect() can be called at most only once.\r\n\r\nI'll write a sample code."}}