{"action":"created","comment":{"url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/comments/167397384","pull_request_review_id":95620834,"id":167397384,"diff_hunk":"@@ -0,0 +1,272 @@\n+const EventEmitter = require('events');\n+const path = require('path');\n+const {load, BufferReader} = require('protobufjs');\n+const {\n+  MCS_VERSION_TAG_AND_SIZE,\n+  MCS_TAG_AND_SIZE,\n+  MCS_SIZE,\n+  MCS_PROTO_BYTES,\n+\n+  kVersionPacketLen,\n+  kTagPacketLen,\n+  kSizePacketLenMin,\n+  kMCSVersion,\n+\n+  kHeartbeatPingTag,\n+  kHeartbeatAckTag,\n+  kLoginRequestTag,\n+  kLoginResponseTag,\n+  kCloseTag,\n+  kIqStanzaTag,\n+  kDataMessageStanzaTag,\n+  kStreamErrorStanzaTag,\n+} = require('./constants');\n+\n+const DEBUG = () => {};","path":"src/parser.js","position":25,"original_position":25,"commit_id":"c8b7c985ee790ebbf77d9867560e2146d010b5ed","original_commit_id":"9abeec9dbc1cdd5f73bc4513bf36c150f8b6c032","user":{"login":"MatthieuLemoine","id":8517072,"avatar_url":"https://avatars0.githubusercontent.com/u/8517072?v=4","gravatar_id":"","url":"https://api.github.com/users/MatthieuLemoine","html_url":"https://github.com/MatthieuLemoine","followers_url":"https://api.github.com/users/MatthieuLemoine/followers","following_url":"https://api.github.com/users/MatthieuLemoine/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuLemoine/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuLemoine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuLemoine/subscriptions","organizations_url":"https://api.github.com/users/MatthieuLemoine/orgs","repos_url":"https://api.github.com/users/MatthieuLemoine/repos","events_url":"https://api.github.com/users/MatthieuLemoine/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuLemoine/received_events","type":"User","site_admin":false},"body":"We could use https://github.com/visionmedia/debug instead","created_at":"2018-02-10T12:11:04Z","updated_at":"2018-02-10T12:17:08Z","html_url":"https://github.com/MatthieuLemoine/push-receiver/pull/13#discussion_r167397384","pull_request_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/comments/167397384"},"html":{"href":"https://github.com/MatthieuLemoine/push-receiver/pull/13#discussion_r167397384"},"pull_request":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13","id":167582477,"html_url":"https://github.com/MatthieuLemoine/push-receiver/pull/13","diff_url":"https://github.com/MatthieuLemoine/push-receiver/pull/13.diff","patch_url":"https://github.com/MatthieuLemoine/push-receiver/pull/13.patch","issue_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/issues/13","number":13,"state":"open","locked":false,"title":"Port chromium message parser and refactor","user":{"login":"ibash","id":204566,"avatar_url":"https://avatars2.githubusercontent.com/u/204566?v=4","gravatar_id":"","url":"https://api.github.com/users/ibash","html_url":"https://github.com/ibash","followers_url":"https://api.github.com/users/ibash/followers","following_url":"https://api.github.com/users/ibash/following{/other_user}","gists_url":"https://api.github.com/users/ibash/gists{/gist_id}","starred_url":"https://api.github.com/users/ibash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibash/subscriptions","organizations_url":"https://api.github.com/users/ibash/orgs","repos_url":"https://api.github.com/users/ibash/repos","events_url":"https://api.github.com/users/ibash/events{/privacy}","received_events_url":"https://api.github.com/users/ibash/received_events","type":"User","site_admin":false},"body":"This commit:\r\n1. Adds sanity tests against chrome gcm. To use the tests copy\r\n   test/keys.template.js to test/keys.js and populate it with gcm\r\n   credentials / sender id. Then do `npm run test`\r\n\r\n2. Ports chromium's ConnectionHandlerImpl::WaitForData. This fixes the\r\n   problem of not parsing the wire format correctly. There are two\r\n   more things here that would be nice to port:\r\n   - Add timeouts while waiting for message bytes\r\n   - Error handling around protobufs\r\n\r\n   I did make the simplification of not supporting the\r\n   kDefaultDataPacketLimit limit (it shouldn't affect correctness)\r\n\r\n   ref: https://cs.chromium.org/chromium/src/google_apis/gcm/engine/connection_handler_impl.cc?rcl=dc7c41bc0ee5fee0ed269495dde6b8c40df43e40&l=178\r\n\r\n3. Refactors client and socket into a class. Combining them made it\r\n   easier to cleanup the socket at the end of the test. It also has the\r\n   benefit of making the retrying a bit cleaner.\r\n\r\n\r\nFor the code reviewer: I'd love to have a second pair of eyes comparing the port to the original from https://cs.chromium.org/chromium/src/google_apis/gcm/engine/connection_handler_impl.cc?rcl=dc7c41bc0ee5fee0ed269495dde6b8c40df43e40&l=178. In particular - is there anything major I missed? Is there anything slightly different? Any off by one errors?","created_at":"2018-02-07T02:23:26Z","updated_at":"2018-02-10T12:17:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b63745ac91e224e15a88bcc07a6a563ee9ff80a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13/commits","review_comments_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13/comments","review_comment_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/issues/13/comments","statuses_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/statuses/c8b7c985ee790ebbf77d9867560e2146d010b5ed","head":{"label":"superhuman:parser_2","ref":"parser_2","sha":"c8b7c985ee790ebbf77d9867560e2146d010b5ed","user":{"login":"superhuman","id":11510192,"avatar_url":"https://avatars0.githubusercontent.com/u/11510192?v=4","gravatar_id":"","url":"https://api.github.com/users/superhuman","html_url":"https://github.com/superhuman","followers_url":"https://api.github.com/users/superhuman/followers","following_url":"https://api.github.com/users/superhuman/following{/other_user}","gists_url":"https://api.github.com/users/superhuman/gists{/gist_id}","starred_url":"https://api.github.com/users/superhuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superhuman/subscriptions","organizations_url":"https://api.github.com/users/superhuman/orgs","repos_url":"https://api.github.com/users/superhuman/repos","events_url":"https://api.github.com/users/superhuman/events{/privacy}","received_events_url":"https://api.github.com/users/superhuman/received_events","type":"Organization","site_admin":false},"repo":{"id":116438969,"name":"push-receiver","full_name":"superhuman/push-receiver","owner":{"login":"superhuman","id":11510192,"avatar_url":"https://avatars0.githubusercontent.com/u/11510192?v=4","gravatar_id":"","url":"https://api.github.com/users/superhuman","html_url":"https://github.com/superhuman","followers_url":"https://api.github.com/users/superhuman/followers","following_url":"https://api.github.com/users/superhuman/following{/other_user}","gists_url":"https://api.github.com/users/superhuman/gists{/gist_id}","starred_url":"https://api.github.com/users/superhuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superhuman/subscriptions","organizations_url":"https://api.github.com/users/superhuman/orgs","repos_url":"https://api.github.com/users/superhuman/repos","events_url":"https://api.github.com/users/superhuman/events{/privacy}","received_events_url":"https://api.github.com/users/superhuman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/superhuman/push-receiver","description":"A library to subscribe to GCM/FCM and receive notifications within a node process.","fork":true,"url":"https://api.github.com/repos/superhuman/push-receiver","forks_url":"https://api.github.com/repos/superhuman/push-receiver/forks","keys_url":"https://api.github.com/repos/superhuman/push-receiver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/superhuman/push-receiver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/superhuman/push-receiver/teams","hooks_url":"https://api.github.com/repos/superhuman/push-receiver/hooks","issue_events_url":"https://api.github.com/repos/superhuman/push-receiver/issues/events{/number}","events_url":"https://api.github.com/repos/superhuman/push-receiver/events","assignees_url":"https://api.github.com/repos/superhuman/push-receiver/assignees{/user}","branches_url":"https://api.github.com/repos/superhuman/push-receiver/branches{/branch}","tags_url":"https://api.github.com/repos/superhuman/push-receiver/tags","blobs_url":"https://api.github.com/repos/superhuman/push-receiver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/superhuman/push-receiver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/superhuman/push-receiver/git/refs{/sha}","trees_url":"https://api.github.com/repos/superhuman/push-receiver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/superhuman/push-receiver/statuses/{sha}","languages_url":"https://api.github.com/repos/superhuman/push-receiver/languages","stargazers_url":"https://api.github.com/repos/superhuman/push-receiver/stargazers","contributors_url":"https://api.github.com/repos/superhuman/push-receiver/contributors","subscribers_url":"https://api.github.com/repos/superhuman/push-receiver/subscribers","subscription_url":"https://api.github.com/repos/superhuman/push-receiver/subscription","commits_url":"https://api.github.com/repos/superhuman/push-receiver/commits{/sha}","git_commits_url":"https://api.github.com/repos/superhuman/push-receiver/git/commits{/sha}","comments_url":"https://api.github.com/repos/superhuman/push-receiver/comments{/number}","issue_comment_url":"https://api.github.com/repos/superhuman/push-receiver/issues/comments{/number}","contents_url":"https://api.github.com/repos/superhuman/push-receiver/contents/{+path}","compare_url":"https://api.github.com/repos/superhuman/push-receiver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/superhuman/push-receiver/merges","archive_url":"https://api.github.com/repos/superhuman/push-receiver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/superhuman/push-receiver/downloads","issues_url":"https://api.github.com/repos/superhuman/push-receiver/issues{/number}","pulls_url":"https://api.github.com/repos/superhuman/push-receiver/pulls{/number}","milestones_url":"https://api.github.com/repos/superhuman/push-receiver/milestones{/number}","notifications_url":"https://api.github.com/repos/superhuman/push-receiver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/superhuman/push-receiver/labels{/name}","releases_url":"https://api.github.com/repos/superhuman/push-receiver/releases{/id}","deployments_url":"https://api.github.com/repos/superhuman/push-receiver/deployments","created_at":"2018-01-05T23:58:49Z","updated_at":"2018-01-05T23:58:51Z","pushed_at":"2018-02-10T12:16:53Z","git_url":"git://github.com/superhuman/push-receiver.git","ssh_url":"git@github.com:superhuman/push-receiver.git","clone_url":"https://github.com/superhuman/push-receiver.git","svn_url":"https://github.com/superhuman/push-receiver","homepage":"https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0","size":117,"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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MatthieuLemoine:master","ref":"master","sha":"fd8f849da050f8422abe8a03558fafb901793152","user":{"login":"MatthieuLemoine","id":8517072,"avatar_url":"https://avatars0.githubusercontent.com/u/8517072?v=4","gravatar_id":"","url":"https://api.github.com/users/MatthieuLemoine","html_url":"https://github.com/MatthieuLemoine","followers_url":"https://api.github.com/users/MatthieuLemoine/followers","following_url":"https://api.github.com/users/MatthieuLemoine/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuLemoine/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuLemoine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuLemoine/subscriptions","organizations_url":"https://api.github.com/users/MatthieuLemoine/orgs","repos_url":"https://api.github.com/users/MatthieuLemoine/repos","events_url":"https://api.github.com/users/MatthieuLemoine/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuLemoine/received_events","type":"User","site_admin":false},"repo":{"id":101927484,"name":"push-receiver","full_name":"MatthieuLemoine/push-receiver","owner":{"login":"MatthieuLemoine","id":8517072,"avatar_url":"https://avatars0.githubusercontent.com/u/8517072?v=4","gravatar_id":"","url":"https://api.github.com/users/MatthieuLemoine","html_url":"https://github.com/MatthieuLemoine","followers_url":"https://api.github.com/users/MatthieuLemoine/followers","following_url":"https://api.github.com/users/MatthieuLemoine/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuLemoine/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuLemoine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuLemoine/subscriptions","organizations_url":"https://api.github.com/users/MatthieuLemoine/orgs","repos_url":"https://api.github.com/users/MatthieuLemoine/repos","events_url":"https://api.github.com/users/MatthieuLemoine/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuLemoine/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MatthieuLemoine/push-receiver","description":"A library to subscribe to GCM/FCM and receive notifications within a node process.","fork":false,"url":"https://api.github.com/repos/MatthieuLemoine/push-receiver","forks_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/forks","keys_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/teams","hooks_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/hooks","issue_events_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/issues/events{/number}","events_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/events","assignees_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/assignees{/user}","branches_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/branches{/branch}","tags_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/tags","blobs_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/git/refs{/sha}","trees_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/statuses/{sha}","languages_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/languages","stargazers_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/stargazers","contributors_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/contributors","subscribers_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/subscribers","subscription_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/subscription","commits_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/commits{/sha}","git_commits_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/git/commits{/sha}","comments_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/comments{/number}","issue_comment_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/issues/comments{/number}","contents_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/contents/{+path}","compare_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/merges","archive_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/downloads","issues_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/issues{/number}","pulls_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls{/number}","milestones_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/milestones{/number}","notifications_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/labels{/name}","releases_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/releases{/id}","deployments_url":"https://api.github.com/repos/MatthieuLemoine/push-receiver/deployments","created_at":"2017-08-30T20:49:11Z","updated_at":"2018-01-29T09:52:39Z","pushed_at":"2018-02-10T12:16:54Z","git_url":"git://github.com/MatthieuLemoine/push-receiver.git","ssh_url":"git@github.com:MatthieuLemoine/push-receiver.git","clone_url":"https://github.com/MatthieuLemoine/push-receiver.git","svn_url":"https://github.com/MatthieuLemoine/push-receiver","homepage":"https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0","size":91,"stargazers_count":31,"watchers_count":31,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":7,"open_issues":6,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13"},"html":{"href":"https://github.com/MatthieuLemoine/push-receiver/pull/13"},"issue":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/issues/13"},"comments":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/MatthieuLemoine/push-receiver/statuses/c8b7c985ee790ebbf77d9867560e2146d010b5ed"}},"author_association":"NONE"}}
{"actor":{"display_login":"MatthieuLemoine"}}