{"action":"created","issue":{"url":"https://api.github.com/repos/afrad/angular2-websocket/issues/87","repository_url":"https://api.github.com/repos/afrad/angular2-websocket","labels_url":"https://api.github.com/repos/afrad/angular2-websocket/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/afrad/angular2-websocket/issues/87/comments","events_url":"https://api.github.com/repos/afrad/angular2-websocket/issues/87/events","html_url":"https://github.com/afrad/angular2-websocket/issues/87","id":253657176,"number":87,"title":"Interrupt reconnectAttempts manually","user":{"login":"mburger81","id":3778892,"avatar_url":"https://avatars0.githubusercontent.com/u/3778892?v=4","gravatar_id":"","url":"https://api.github.com/users/mburger81","html_url":"https://github.com/mburger81","followers_url":"https://api.github.com/users/mburger81/followers","following_url":"https://api.github.com/users/mburger81/following{/other_user}","gists_url":"https://api.github.com/users/mburger81/gists{/gist_id}","starred_url":"https://api.github.com/users/mburger81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mburger81/subscriptions","organizations_url":"https://api.github.com/users/mburger81/orgs","repos_url":"https://api.github.com/users/mburger81/repos","events_url":"https://api.github.com/users/mburger81/events{/privacy}","received_events_url":"https://api.github.com/users/mburger81/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-08-29T13:20:36Z","updated_at":"2017-09-25T11:22:04Z","closed_at":"2017-09-25T11:22:04Z","author_association":"CONTRIBUTOR","body":"If we leave component we can close `WebSocket` fine and anything is as expected. The problem is if the `WebSocket` is not connected and we set `{\"reconnectIfNotNormalClose\": true}` the [Websocket](url) could not by closed or interrupted.\r\n\r\nOn leaving the component we do this\r\n```\r\n            console.log('#close 1: ', this.ws.getReadyState());\r\n            console.log('#close 2: ', this.ws.close(true));\r\n            console.log('#close 3: ', this.ws);\r\n            console.log('#close 4: ', this.ws.getReadyState());\r\n```\r\nwe can see before set close command the `readyState` is `0` which means `connecting` and after `forsce` the `close` the `state` is `3` which means `closed`.\r\nBut the problem is, also after leaving the component and closed the websocket, the websocket is still attempting to reconnect the websocket.\r\n\r\nclose method could handle something like this:\r\n\r\n```\r\n$WebSocket.prototype.close = function (force) {\r\n        if (force === void 0) { force = false; }\r\n        if (force || !this.socket.bufferedAmount) {\r\n            this.socket.close(this.normalCloseCode);\r\n\r\n            // NEW CODE\r\n            this.config.reconnectIfNotNormalClose = false\r\n            // NEW CODE\r\n        }\r\n        return this;\r\n    };\r\n```"},"comment":{"url":"https://api.github.com/repos/afrad/angular2-websocket/issues/comments/331851709","html_url":"https://github.com/afrad/angular2-websocket/issues/87#issuecomment-331851709","issue_url":"https://api.github.com/repos/afrad/angular2-websocket/issues/87","id":331851709,"user":{"login":"mburger81","id":3778892,"avatar_url":"https://avatars0.githubusercontent.com/u/3778892?v=4","gravatar_id":"","url":"https://api.github.com/users/mburger81","html_url":"https://github.com/mburger81","followers_url":"https://api.github.com/users/mburger81/followers","following_url":"https://api.github.com/users/mburger81/following{/other_user}","gists_url":"https://api.github.com/users/mburger81/gists{/gist_id}","starred_url":"https://api.github.com/users/mburger81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mburger81/subscriptions","organizations_url":"https://api.github.com/users/mburger81/orgs","repos_url":"https://api.github.com/users/mburger81/repos","events_url":"https://api.github.com/users/mburger81/events{/privacy}","received_events_url":"https://api.github.com/users/mburger81/received_events","type":"User","site_admin":false},"created_at":"2017-09-25T11:22:04Z","updated_at":"2017-09-25T11:22:04Z","author_association":"CONTRIBUTOR","body":"closed by release 0.9.5"}}
{"actor":{"display_login":"mburger81"}}