{"action":"created","comment":{"url":"https://api.github.com/repos/appuri/robust-websocket/pulls/comments/222847611","pull_request_review_id":161835719,"id":222847611,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjg0NzYxMQ==","diff_hunk":"@@ -75,6 +77,12 @@\n     }\n \n     self.send = function() {\n+      if (realWs.readyState !== self.OPEN) {\n+        throw Object.assign(\n+          new Error('An attempt was made to use a WebSocket that is not usable'),\n+          { name: 'InvalidStateError' }\n+        )\n+      }","path":"robust-websocket.js","position":18,"original_position":18,"commit_id":"5e042f603a1485fc54a4f3c4819b69e6a003e26c","original_commit_id":"5e042f603a1485fc54a4f3c4819b69e6a003e26c","user":{"login":"keithamus","id":118266,"node_id":"MDQ6VXNlcjExODI2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/118266?v=4","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":true},"body":"As previously stated - `realWs.send` is not always present","created_at":"2018-10-04T22:33:38Z","updated_at":"2018-10-04T22:33:38Z","html_url":"https://github.com/appuri/robust-websocket/pull/24#discussion_r222847611","pull_request_url":"https://api.github.com/repos/appuri/robust-websocket/pulls/24","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/appuri/robust-websocket/pulls/comments/222847611"},"html":{"href":"https://github.com/appuri/robust-websocket/pull/24#discussion_r222847611"},"pull_request":{"href":"https://api.github.com/repos/appuri/robust-websocket/pulls/24"}},"in_reply_to_id":222838598},"pull_request":{"url":"https://api.github.com/repos/appuri/robust-websocket/pulls/24","id":220459221,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNDU5MjIx","html_url":"https://github.com/appuri/robust-websocket/pull/24","diff_url":"https://github.com/appuri/robust-websocket/pull/24.diff","patch_url":"https://github.com/appuri/robust-websocket/pull/24.patch","issue_url":"https://api.github.com/repos/appuri/robust-websocket/issues/24","number":24,"state":"open","locked":false,"title":"fix: be defensive around use of window.WebSocket","user":{"login":"keithamus","id":118266,"node_id":"MDQ6VXNlcjExODI2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/118266?v=4","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":true},"body":"This fixes #19, #23 by being more defensive around the use of `window.WebSocket`.\r\n\r\nIt also provides more informational errors when attempting to call `.send()` on a WebSocket that is not `OPEN`.","created_at":"2018-10-04T17:34:56Z","updated_at":"2018-10-04T22:33:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c5bf97aba0b8155ef45252bc791b9ced54cd8cf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/appuri/robust-websocket/pulls/24/commits","review_comments_url":"https://api.github.com/repos/appuri/robust-websocket/pulls/24/comments","review_comment_url":"https://api.github.com/repos/appuri/robust-websocket/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appuri/robust-websocket/issues/24/comments","statuses_url":"https://api.github.com/repos/appuri/robust-websocket/statuses/5e042f603a1485fc54a4f3c4819b69e6a003e26c","head":{"label":"keithamus:fix-be-defensive-around-use-of-window-websocket","ref":"fix-be-defensive-around-use-of-window-websocket","sha":"5e042f603a1485fc54a4f3c4819b69e6a003e26c","user":{"login":"keithamus","id":118266,"node_id":"MDQ6VXNlcjExODI2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/118266?v=4","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":true},"repo":{"id":151493716,"node_id":"MDEwOlJlcG9zaXRvcnkxNTE0OTM3MTY=","name":"robust-websocket-1","full_name":"keithamus/robust-websocket-1","private":false,"owner":{"login":"keithamus","id":118266,"node_id":"MDQ6VXNlcjExODI2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/118266?v=4","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":true},"html_url":"https://github.com/keithamus/robust-websocket-1","description":"A robust reconnecting WebSocket client for the browser","fork":true,"url":"https://api.github.com/repos/keithamus/robust-websocket-1","forks_url":"https://api.github.com/repos/keithamus/robust-websocket-1/forks","keys_url":"https://api.github.com/repos/keithamus/robust-websocket-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keithamus/robust-websocket-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keithamus/robust-websocket-1/teams","hooks_url":"https://api.github.com/repos/keithamus/robust-websocket-1/hooks","issue_events_url":"https://api.github.com/repos/keithamus/robust-websocket-1/issues/events{/number}","events_url":"https://api.github.com/repos/keithamus/robust-websocket-1/events","assignees_url":"https://api.github.com/repos/keithamus/robust-websocket-1/assignees{/user}","branches_url":"https://api.github.com/repos/keithamus/robust-websocket-1/branches{/branch}","tags_url":"https://api.github.com/repos/keithamus/robust-websocket-1/tags","blobs_url":"https://api.github.com/repos/keithamus/robust-websocket-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keithamus/robust-websocket-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keithamus/robust-websocket-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/keithamus/robust-websocket-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keithamus/robust-websocket-1/statuses/{sha}","languages_url":"https://api.github.com/repos/keithamus/robust-websocket-1/languages","stargazers_url":"https://api.github.com/repos/keithamus/robust-websocket-1/stargazers","contributors_url":"https://api.github.com/repos/keithamus/robust-websocket-1/contributors","subscribers_url":"https://api.github.com/repos/keithamus/robust-websocket-1/subscribers","subscription_url":"https://api.github.com/repos/keithamus/robust-websocket-1/subscription","commits_url":"https://api.github.com/repos/keithamus/robust-websocket-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/keithamus/robust-websocket-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/keithamus/robust-websocket-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/keithamus/robust-websocket-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/keithamus/robust-websocket-1/contents/{+path}","compare_url":"https://api.github.com/repos/keithamus/robust-websocket-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keithamus/robust-websocket-1/merges","archive_url":"https://api.github.com/repos/keithamus/robust-websocket-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keithamus/robust-websocket-1/downloads","issues_url":"https://api.github.com/repos/keithamus/robust-websocket-1/issues{/number}","pulls_url":"https://api.github.com/repos/keithamus/robust-websocket-1/pulls{/number}","milestones_url":"https://api.github.com/repos/keithamus/robust-websocket-1/milestones{/number}","notifications_url":"https://api.github.com/repos/keithamus/robust-websocket-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keithamus/robust-websocket-1/labels{/name}","releases_url":"https://api.github.com/repos/keithamus/robust-websocket-1/releases{/id}","deployments_url":"https://api.github.com/repos/keithamus/robust-websocket-1/deployments","created_at":"2018-10-03T23:28:38Z","updated_at":"2018-10-03T23:28:40Z","pushed_at":"2018-10-04T17:33:53Z","git_url":"git://github.com/keithamus/robust-websocket-1.git","ssh_url":"git@github.com:keithamus/robust-websocket-1.git","clone_url":"https://github.com/keithamus/robust-websocket-1.git","svn_url":"https://github.com/keithamus/robust-websocket-1","homepage":null,"size":37,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"appuri:master","ref":"master","sha":"200ba2a705ed9cf715eb53ba3a8b393bf00a4d84","user":{"login":"appuri","id":1445727,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0NDU3Mjc=","avatar_url":"https://avatars0.githubusercontent.com/u/1445727?v=4","gravatar_id":"","url":"https://api.github.com/users/appuri","html_url":"https://github.com/appuri","followers_url":"https://api.github.com/users/appuri/followers","following_url":"https://api.github.com/users/appuri/following{/other_user}","gists_url":"https://api.github.com/users/appuri/gists{/gist_id}","starred_url":"https://api.github.com/users/appuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appuri/subscriptions","organizations_url":"https://api.github.com/users/appuri/orgs","repos_url":"https://api.github.com/users/appuri/repos","events_url":"https://api.github.com/users/appuri/events{/privacy}","received_events_url":"https://api.github.com/users/appuri/received_events","type":"Organization","site_admin":false},"repo":{"id":68865025,"node_id":"MDEwOlJlcG9zaXRvcnk2ODg2NTAyNQ==","name":"robust-websocket","full_name":"appuri/robust-websocket","private":false,"owner":{"login":"appuri","id":1445727,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0NDU3Mjc=","avatar_url":"https://avatars0.githubusercontent.com/u/1445727?v=4","gravatar_id":"","url":"https://api.github.com/users/appuri","html_url":"https://github.com/appuri","followers_url":"https://api.github.com/users/appuri/followers","following_url":"https://api.github.com/users/appuri/following{/other_user}","gists_url":"https://api.github.com/users/appuri/gists{/gist_id}","starred_url":"https://api.github.com/users/appuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appuri/subscriptions","organizations_url":"https://api.github.com/users/appuri/orgs","repos_url":"https://api.github.com/users/appuri/repos","events_url":"https://api.github.com/users/appuri/events{/privacy}","received_events_url":"https://api.github.com/users/appuri/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/appuri/robust-websocket","description":"A robust reconnecting WebSocket client for the browser","fork":false,"url":"https://api.github.com/repos/appuri/robust-websocket","forks_url":"https://api.github.com/repos/appuri/robust-websocket/forks","keys_url":"https://api.github.com/repos/appuri/robust-websocket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appuri/robust-websocket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appuri/robust-websocket/teams","hooks_url":"https://api.github.com/repos/appuri/robust-websocket/hooks","issue_events_url":"https://api.github.com/repos/appuri/robust-websocket/issues/events{/number}","events_url":"https://api.github.com/repos/appuri/robust-websocket/events","assignees_url":"https://api.github.com/repos/appuri/robust-websocket/assignees{/user}","branches_url":"https://api.github.com/repos/appuri/robust-websocket/branches{/branch}","tags_url":"https://api.github.com/repos/appuri/robust-websocket/tags","blobs_url":"https://api.github.com/repos/appuri/robust-websocket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appuri/robust-websocket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appuri/robust-websocket/git/refs{/sha}","trees_url":"https://api.github.com/repos/appuri/robust-websocket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appuri/robust-websocket/statuses/{sha}","languages_url":"https://api.github.com/repos/appuri/robust-websocket/languages","stargazers_url":"https://api.github.com/repos/appuri/robust-websocket/stargazers","contributors_url":"https://api.github.com/repos/appuri/robust-websocket/contributors","subscribers_url":"https://api.github.com/repos/appuri/robust-websocket/subscribers","subscription_url":"https://api.github.com/repos/appuri/robust-websocket/subscription","commits_url":"https://api.github.com/repos/appuri/robust-websocket/commits{/sha}","git_commits_url":"https://api.github.com/repos/appuri/robust-websocket/git/commits{/sha}","comments_url":"https://api.github.com/repos/appuri/robust-websocket/comments{/number}","issue_comment_url":"https://api.github.com/repos/appuri/robust-websocket/issues/comments{/number}","contents_url":"https://api.github.com/repos/appuri/robust-websocket/contents/{+path}","compare_url":"https://api.github.com/repos/appuri/robust-websocket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appuri/robust-websocket/merges","archive_url":"https://api.github.com/repos/appuri/robust-websocket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appuri/robust-websocket/downloads","issues_url":"https://api.github.com/repos/appuri/robust-websocket/issues{/number}","pulls_url":"https://api.github.com/repos/appuri/robust-websocket/pulls{/number}","milestones_url":"https://api.github.com/repos/appuri/robust-websocket/milestones{/number}","notifications_url":"https://api.github.com/repos/appuri/robust-websocket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appuri/robust-websocket/labels{/name}","releases_url":"https://api.github.com/repos/appuri/robust-websocket/releases{/id}","deployments_url":"https://api.github.com/repos/appuri/robust-websocket/deployments","created_at":"2016-09-21T23:10:35Z","updated_at":"2018-09-25T02:30:54Z","pushed_at":"2018-10-04T17:34:57Z","git_url":"git://github.com/appuri/robust-websocket.git","ssh_url":"git@github.com:appuri/robust-websocket.git","clone_url":"https://github.com/appuri/robust-websocket.git","svn_url":"https://github.com/appuri/robust-websocket","homepage":null,"size":35,"stargazers_count":72,"watchers_count":72,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":14,"open_issues":5,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appuri/robust-websocket/pulls/24"},"html":{"href":"https://github.com/appuri/robust-websocket/pull/24"},"issue":{"href":"https://api.github.com/repos/appuri/robust-websocket/issues/24"},"comments":{"href":"https://api.github.com/repos/appuri/robust-websocket/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/appuri/robust-websocket/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/appuri/robust-websocket/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appuri/robust-websocket/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/appuri/robust-websocket/statuses/5e042f603a1485fc54a4f3c4819b69e6a003e26c"}},"author_association":"NONE"}}
{"actor":{"display_login":"keithamus"}}