{"action":"created","issue":{"url":"https://api.github.com/repos/pladaria/reconnecting-websocket/issues/60","repository_url":"https://api.github.com/repos/pladaria/reconnecting-websocket","labels_url":"https://api.github.com/repos/pladaria/reconnecting-websocket/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/pladaria/reconnecting-websocket/issues/60/comments","events_url":"https://api.github.com/repos/pladaria/reconnecting-websocket/issues/60/events","html_url":"https://github.com/pladaria/reconnecting-websocket/issues/60","id":323247613,"node_id":"MDU6SXNzdWUzMjMyNDc2MTM=","number":60,"title":"onclose behaviour has changed -- was it intentional?","user":{"login":"naggie","id":208440,"node_id":"MDQ6VXNlcjIwODQ0MA==","avatar_url":"https://avatars2.githubusercontent.com/u/208440?v=4","gravatar_id":"","url":"https://api.github.com/users/naggie","html_url":"https://github.com/naggie","followers_url":"https://api.github.com/users/naggie/followers","following_url":"https://api.github.com/users/naggie/following{/other_user}","gists_url":"https://api.github.com/users/naggie/gists{/gist_id}","starred_url":"https://api.github.com/users/naggie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naggie/subscriptions","organizations_url":"https://api.github.com/users/naggie/orgs","repos_url":"https://api.github.com/users/naggie/repos","events_url":"https://api.github.com/users/naggie/events{/privacy}","received_events_url":"https://api.github.com/users/naggie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2018-05-15T14:38:21Z","updated_at":"2018-07-23T02:41:14Z","closed_at":null,"author_association":"NONE","body":"I noticed my application was failing to reconnect after the reconnecting-websocket rewrite. Upon investigation, I realised this seems to be because this library no longer reconnects when a websocket is intentionally closed by the server --  a `close` event is triggered but nothing else happens.\r\n\r\nPreviously, a graceful server-side close event would trigger a reconnect:\r\nhttps://github.com/pladaria/reconnecting-websocket/blob/e79fba552f236463adac04e1872f5e20e37d66a1/index.ts#L141\r\n\r\n...but now the reconnect is not triggered: https://github.com/pladaria/reconnecting-websocket/blob/2e5d6f0406784da357e3213506c9b508c2b32991/reconnecting-websocket.ts#L392\r\n\r\n\r\nThe reconnect mechanism is triggered on `error` so I suspect this is an intentional change.\r\n\r\nWhat do you think about adding a `reconnectOnClose` option, on by default? \r\n\r\nAlternatively the docs could be updated to clarify this behaviour, and perhaps suggest manually binding a reconnect such as:\r\n\r\n```\r\nrws.addEventListener('close', () => rws.reconnect());\r\n\r\n```\r\n\r\nAlthough that seems to cause thrashing if the connection cannot be established, as reconnect calls `_disconnect` which calls the handlers again.\r\n\r\n\r\nThanks for the well written library."},"comment":{"url":"https://api.github.com/repos/pladaria/reconnecting-websocket/issues/comments/406923114","html_url":"https://github.com/pladaria/reconnecting-websocket/issues/60#issuecomment-406923114","issue_url":"https://api.github.com/repos/pladaria/reconnecting-websocket/issues/60","id":406923114,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjkyMzExNA==","user":{"login":"tab00","id":12715448,"node_id":"MDQ6VXNlcjEyNzE1NDQ4","avatar_url":"https://avatars0.githubusercontent.com/u/12715448?v=4","gravatar_id":"","url":"https://api.github.com/users/tab00","html_url":"https://github.com/tab00","followers_url":"https://api.github.com/users/tab00/followers","following_url":"https://api.github.com/users/tab00/following{/other_user}","gists_url":"https://api.github.com/users/tab00/gists{/gist_id}","starred_url":"https://api.github.com/users/tab00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tab00/subscriptions","organizations_url":"https://api.github.com/users/tab00/orgs","repos_url":"https://api.github.com/users/tab00/repos","events_url":"https://api.github.com/users/tab00/events{/privacy}","received_events_url":"https://api.github.com/users/tab00/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T02:41:14Z","updated_at":"2018-07-23T02:41:14Z","author_association":"NONE","body":"Please make it reconnect after a disconnect."}}
{"actor":{"display_login":"tab00"}}