{"action":"created","comment":{"url":"https://api.github.com/repos/agco/harvesterjs/pulls/comments/41173349","id":41173349,"diff_hunk":"@@ -0,0 +1,128 @@\n+var _ = require('lodash');\n+var mongojs = require('mongojs');\n+var inflect = require('i')();\n+var tinySSE = require('tiny-sse');\n+var SSE = require('./sse');\n+var Promise = require('bluebird');\n+var hl = require('highland');\n+var JSONAPI_Error = require('./jsonapi-error');\n+\n+var MultiSSE = function() {\n+};\n+\n+MultiSSE.prototype.init = function(harvesterApp) {\n+    this.options = harvesterApp.options;\n+    this.db = mongojs(this.options.oplogConnectionString);\n+    this.coll = this.db.collection('oplog.rs');\n+    this.harvesterApp = harvesterApp;\n+    harvesterApp.router.get(this.options.baseUrl + '/changes/stream', this.checkValidRequestMiddleware.bind(this), tinySSE.head(), tinySSE.ticker({seconds: 3}), this.handler.bind(this));\n+};\n+\n+MultiSSE.prototype.checkValidRequestMiddleware = function (req, res, next) {","path":"lib/multi-sse.js","position":21,"original_position":21,"commit_id":"98f02e0701f60843122af55a44df13aa168942f1","original_commit_id":"98f02e0701f60843122af55a44df13aa168942f1","user":{"login":"ssebro","id":372075,"avatar_url":"https://avatars.githubusercontent.com/u/372075?v=3","gravatar_id":"","url":"https://api.github.com/users/ssebro","html_url":"https://github.com/ssebro","followers_url":"https://api.github.com/users/ssebro/followers","following_url":"https://api.github.com/users/ssebro/following{/other_user}","gists_url":"https://api.github.com/users/ssebro/gists{/gist_id}","starred_url":"https://api.github.com/users/ssebro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssebro/subscriptions","organizations_url":"https://api.github.com/users/ssebro/orgs","repos_url":"https://api.github.com/users/ssebro/repos","events_url":"https://api.github.com/users/ssebro/events{/privacy}","received_events_url":"https://api.github.com/users/ssebro/received_events","type":"User","site_admin":false},"body":"seems like a request validation middleware, which is nice :). Might be more obvious if you called it requestValidationMiddleware - do you agree that this change increases readability?","created_at":"2015-10-05T17:40:41Z","updated_at":"2015-10-05T17:40:41Z","html_url":"https://github.com/agco/harvesterjs/pull/144#discussion_r41173349","pull_request_url":"https://api.github.com/repos/agco/harvesterjs/pulls/144","_links":{"self":{"href":"https://api.github.com/repos/agco/harvesterjs/pulls/comments/41173349"},"html":{"href":"https://github.com/agco/harvesterjs/pull/144#discussion_r41173349"},"pull_request":{"href":"https://api.github.com/repos/agco/harvesterjs/pulls/144"}}},"pull_request":{"url":"https://api.github.com/repos/agco/harvesterjs/pulls/144","id":46769499,"html_url":"https://github.com/agco/harvesterjs/pull/144","diff_url":"https://github.com/agco/harvesterjs/pull/144.diff","patch_url":"https://github.com/agco/harvesterjs/pull/144.patch","issue_url":"https://api.github.com/repos/agco/harvesterjs/issues/144","number":144,"state":"open","locked":false,"title":"Feature/glblagctwo 1092","user":{"login":"mavdi","id":767675,"avatar_url":"https://avatars.githubusercontent.com/u/767675?v=3","gravatar_id":"","url":"https://api.github.com/users/mavdi","html_url":"https://github.com/mavdi","followers_url":"https://api.github.com/users/mavdi/followers","following_url":"https://api.github.com/users/mavdi/following{/other_user}","gists_url":"https://api.github.com/users/mavdi/gists{/gist_id}","starred_url":"https://api.github.com/users/mavdi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavdi/subscriptions","organizations_url":"https://api.github.com/users/mavdi/orgs","repos_url":"https://api.github.com/users/mavdi/repos","events_url":"https://api.github.com/users/mavdi/events{/privacy}","received_events_url":"https://api.github.com/users/mavdi/received_events","type":"User","site_admin":false},"body":"<a href='#crh-start'></a><a href='#crh-data-%7B%7D'></a>\n<a href='https://www.codereviewhub.com/'><img src='http://www.codereviewhub.com/site/github-bar.png' height=40></a>\n<a href='https://www.codereviewhub.com/agco/harvesterjs/pull/144?approve=1'><img src='http://www.codereviewhub.com/site/github-approve.png' height=26></a>&nbsp;<a href='https://github.com/agco/harvesterjs/pull/144'><img src='http://www.codereviewhub.com/site/github-refresh.png' height=26></a>\n<a href='#crh-end'></a>","created_at":"2015-10-05T11:27:20Z","updated_at":"2015-10-05T17:40:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"280736baeea95ffa63a07455be5b5a01070f1fc0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/agco/harvesterjs/pulls/144/commits","review_comments_url":"https://api.github.com/repos/agco/harvesterjs/pulls/144/comments","review_comment_url":"https://api.github.com/repos/agco/harvesterjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/agco/harvesterjs/issues/144/comments","statuses_url":"https://api.github.com/repos/agco/harvesterjs/statuses/98f02e0701f60843122af55a44df13aa168942f1","head":{"label":"agco:feature/GLBLAGCTWO-1092","ref":"feature/GLBLAGCTWO-1092","sha":"98f02e0701f60843122af55a44df13aa168942f1","user":{"login":"agco","id":8579835,"avatar_url":"https://avatars.githubusercontent.com/u/8579835?v=3","gravatar_id":"","url":"https://api.github.com/users/agco","html_url":"https://github.com/agco","followers_url":"https://api.github.com/users/agco/followers","following_url":"https://api.github.com/users/agco/following{/other_user}","gists_url":"https://api.github.com/users/agco/gists{/gist_id}","starred_url":"https://api.github.com/users/agco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agco/subscriptions","organizations_url":"https://api.github.com/users/agco/orgs","repos_url":"https://api.github.com/users/agco/repos","events_url":"https://api.github.com/users/agco/events{/privacy}","received_events_url":"https://api.github.com/users/agco/received_events","type":"Organization","site_admin":false},"repo":{"id":23838217,"name":"harvesterjs","full_name":"agco/harvesterjs","owner":{"login":"agco","id":8579835,"avatar_url":"https://avatars.githubusercontent.com/u/8579835?v=3","gravatar_id":"","url":"https://api.github.com/users/agco","html_url":"https://github.com/agco","followers_url":"https://api.github.com/users/agco/followers","following_url":"https://api.github.com/users/agco/following{/other_user}","gists_url":"https://api.github.com/users/agco/gists{/gist_id}","starred_url":"https://api.github.com/users/agco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agco/subscriptions","organizations_url":"https://api.github.com/users/agco/orgs","repos_url":"https://api.github.com/users/agco/repos","events_url":"https://api.github.com/users/agco/events{/privacy}","received_events_url":"https://api.github.com/users/agco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/agco/harvesterjs","description":"Create JSONAPI-compliant APIs over a Node.js + MongoDB stack in an easy, boilerplate-free manner","fork":true,"url":"https://api.github.com/repos/agco/harvesterjs","forks_url":"https://api.github.com/repos/agco/harvesterjs/forks","keys_url":"https://api.github.com/repos/agco/harvesterjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agco/harvesterjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agco/harvesterjs/teams","hooks_url":"https://api.github.com/repos/agco/harvesterjs/hooks","issue_events_url":"https://api.github.com/repos/agco/harvesterjs/issues/events{/number}","events_url":"https://api.github.com/repos/agco/harvesterjs/events","assignees_url":"https://api.github.com/repos/agco/harvesterjs/assignees{/user}","branches_url":"https://api.github.com/repos/agco/harvesterjs/branches{/branch}","tags_url":"https://api.github.com/repos/agco/harvesterjs/tags","blobs_url":"https://api.github.com/repos/agco/harvesterjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agco/harvesterjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agco/harvesterjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/agco/harvesterjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agco/harvesterjs/statuses/{sha}","languages_url":"https://api.github.com/repos/agco/harvesterjs/languages","stargazers_url":"https://api.github.com/repos/agco/harvesterjs/stargazers","contributors_url":"https://api.github.com/repos/agco/harvesterjs/contributors","subscribers_url":"https://api.github.com/repos/agco/harvesterjs/subscribers","subscription_url":"https://api.github.com/repos/agco/harvesterjs/subscription","commits_url":"https://api.github.com/repos/agco/harvesterjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/agco/harvesterjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/agco/harvesterjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/agco/harvesterjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/agco/harvesterjs/contents/{+path}","compare_url":"https://api.github.com/repos/agco/harvesterjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agco/harvesterjs/merges","archive_url":"https://api.github.com/repos/agco/harvesterjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agco/harvesterjs/downloads","issues_url":"https://api.github.com/repos/agco/harvesterjs/issues{/number}","pulls_url":"https://api.github.com/repos/agco/harvesterjs/pulls{/number}","milestones_url":"https://api.github.com/repos/agco/harvesterjs/milestones{/number}","notifications_url":"https://api.github.com/repos/agco/harvesterjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agco/harvesterjs/labels{/name}","releases_url":"https://api.github.com/repos/agco/harvesterjs/releases{/id}","created_at":"2014-09-09T15:05:17Z","updated_at":"2015-09-30T01:54:56Z","pushed_at":"2015-10-05T13:10:58Z","git_url":"git://github.com/agco/harvesterjs.git","ssh_url":"git@github.com:agco/harvesterjs.git","clone_url":"https://github.com/agco/harvesterjs.git","svn_url":"https://github.com/agco/harvesterjs","homepage":"http://agco.github.io/harvesterjs/","size":2410,"stargazers_count":54,"watchers_count":54,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":8,"mirror_url":null,"open_issues_count":37,"forks":8,"open_issues":37,"watchers":54,"default_branch":"develop"}},"base":{"label":"agco:develop","ref":"develop","sha":"aa0af4525a4b8ec6c45996271d8f22fdbf582ae8","user":{"login":"agco","id":8579835,"avatar_url":"https://avatars.githubusercontent.com/u/8579835?v=3","gravatar_id":"","url":"https://api.github.com/users/agco","html_url":"https://github.com/agco","followers_url":"https://api.github.com/users/agco/followers","following_url":"https://api.github.com/users/agco/following{/other_user}","gists_url":"https://api.github.com/users/agco/gists{/gist_id}","starred_url":"https://api.github.com/users/agco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agco/subscriptions","organizations_url":"https://api.github.com/users/agco/orgs","repos_url":"https://api.github.com/users/agco/repos","events_url":"https://api.github.com/users/agco/events{/privacy}","received_events_url":"https://api.github.com/users/agco/received_events","type":"Organization","site_admin":false},"repo":{"id":23838217,"name":"harvesterjs","full_name":"agco/harvesterjs","owner":{"login":"agco","id":8579835,"avatar_url":"https://avatars.githubusercontent.com/u/8579835?v=3","gravatar_id":"","url":"https://api.github.com/users/agco","html_url":"https://github.com/agco","followers_url":"https://api.github.com/users/agco/followers","following_url":"https://api.github.com/users/agco/following{/other_user}","gists_url":"https://api.github.com/users/agco/gists{/gist_id}","starred_url":"https://api.github.com/users/agco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agco/subscriptions","organizations_url":"https://api.github.com/users/agco/orgs","repos_url":"https://api.github.com/users/agco/repos","events_url":"https://api.github.com/users/agco/events{/privacy}","received_events_url":"https://api.github.com/users/agco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/agco/harvesterjs","description":"Create JSONAPI-compliant APIs over a Node.js + MongoDB stack in an easy, boilerplate-free manner","fork":true,"url":"https://api.github.com/repos/agco/harvesterjs","forks_url":"https://api.github.com/repos/agco/harvesterjs/forks","keys_url":"https://api.github.com/repos/agco/harvesterjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agco/harvesterjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agco/harvesterjs/teams","hooks_url":"https://api.github.com/repos/agco/harvesterjs/hooks","issue_events_url":"https://api.github.com/repos/agco/harvesterjs/issues/events{/number}","events_url":"https://api.github.com/repos/agco/harvesterjs/events","assignees_url":"https://api.github.com/repos/agco/harvesterjs/assignees{/user}","branches_url":"https://api.github.com/repos/agco/harvesterjs/branches{/branch}","tags_url":"https://api.github.com/repos/agco/harvesterjs/tags","blobs_url":"https://api.github.com/repos/agco/harvesterjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agco/harvesterjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agco/harvesterjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/agco/harvesterjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agco/harvesterjs/statuses/{sha}","languages_url":"https://api.github.com/repos/agco/harvesterjs/languages","stargazers_url":"https://api.github.com/repos/agco/harvesterjs/stargazers","contributors_url":"https://api.github.com/repos/agco/harvesterjs/contributors","subscribers_url":"https://api.github.com/repos/agco/harvesterjs/subscribers","subscription_url":"https://api.github.com/repos/agco/harvesterjs/subscription","commits_url":"https://api.github.com/repos/agco/harvesterjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/agco/harvesterjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/agco/harvesterjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/agco/harvesterjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/agco/harvesterjs/contents/{+path}","compare_url":"https://api.github.com/repos/agco/harvesterjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agco/harvesterjs/merges","archive_url":"https://api.github.com/repos/agco/harvesterjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agco/harvesterjs/downloads","issues_url":"https://api.github.com/repos/agco/harvesterjs/issues{/number}","pulls_url":"https://api.github.com/repos/agco/harvesterjs/pulls{/number}","milestones_url":"https://api.github.com/repos/agco/harvesterjs/milestones{/number}","notifications_url":"https://api.github.com/repos/agco/harvesterjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agco/harvesterjs/labels{/name}","releases_url":"https://api.github.com/repos/agco/harvesterjs/releases{/id}","created_at":"2014-09-09T15:05:17Z","updated_at":"2015-09-30T01:54:56Z","pushed_at":"2015-10-05T13:10:58Z","git_url":"git://github.com/agco/harvesterjs.git","ssh_url":"git@github.com:agco/harvesterjs.git","clone_url":"https://github.com/agco/harvesterjs.git","svn_url":"https://github.com/agco/harvesterjs","homepage":"http://agco.github.io/harvesterjs/","size":2410,"stargazers_count":54,"watchers_count":54,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":8,"mirror_url":null,"open_issues_count":37,"forks":8,"open_issues":37,"watchers":54,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/agco/harvesterjs/pulls/144"},"html":{"href":"https://github.com/agco/harvesterjs/pull/144"},"issue":{"href":"https://api.github.com/repos/agco/harvesterjs/issues/144"},"comments":{"href":"https://api.github.com/repos/agco/harvesterjs/issues/144/comments"},"review_comments":{"href":"https://api.github.com/repos/agco/harvesterjs/pulls/144/comments"},"review_comment":{"href":"https://api.github.com/repos/agco/harvesterjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/agco/harvesterjs/pulls/144/commits"},"statuses":{"href":"https://api.github.com/repos/agco/harvesterjs/statuses/98f02e0701f60843122af55a44df13aa168942f1"}}}}