{"action":"created","comment":{"url":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/comments/24120969","id":24120969,"diff_hunk":"@@ -180,6 +180,26 @@ export function get(name: string): any\n                     arg: 'websocket-ws-port'\n                 },\n             }\n+        },\n+        'longPoll': {","path":"lib/config.ts","position":5,"original_position":5,"commit_id":"23bfbb3727f541de91fd1abcb18431407a328038","original_commit_id":"23bfbb3727f541de91fd1abcb18431407a328038","user":{"login":"ericvw","id":1284017,"avatar_url":"https://avatars.githubusercontent.com/u/1284017?v=3","gravatar_id":"","url":"https://api.github.com/users/ericvw","html_url":"https://github.com/ericvw","followers_url":"https://api.github.com/users/ericvw/followers","following_url":"https://api.github.com/users/ericvw/following{/other_user}","gists_url":"https://api.github.com/users/ericvw/gists{/gist_id}","starred_url":"https://api.github.com/users/ericvw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericvw/subscriptions","organizations_url":"https://api.github.com/users/ericvw/orgs","repos_url":"https://api.github.com/users/ericvw/repos","events_url":"https://api.github.com/users/ericvw/events{/privacy}","received_events_url":"https://api.github.com/users/ericvw/received_events","type":"User","site_admin":false},"body":"For this line and the remaining part of this section of the config files, let's lower-case everything and use `-` where appropriate.  I think `longpoll` is acceptable.","created_at":"2015-02-04T21:24:54Z","updated_at":"2015-02-04T21:24:54Z","html_url":"https://github.com/bloomberg/blpapi-http/pull/44#discussion_r24120969","pull_request_url":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/comments/24120969"},"html":{"href":"https://github.com/bloomberg/blpapi-http/pull/44#discussion_r24120969"},"pull_request":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44","id":28615655,"html_url":"https://github.com/bloomberg/blpapi-http/pull/44","diff_url":"https://github.com/bloomberg/blpapi-http/pull/44.diff","patch_url":"https://github.com/bloomberg/blpapi-http/pull/44.patch","issue_url":"https://api.github.com/repos/bloomberg/blpapi-http/issues/44","number":44,"state":"open","locked":false,"title":"Add subscription over long-polling","user":{"login":"ericlu88","id":3301112,"avatar_url":"https://avatars.githubusercontent.com/u/3301112?v=3","gravatar_id":"","url":"https://api.github.com/users/ericlu88","html_url":"https://github.com/ericlu88","followers_url":"https://api.github.com/users/ericlu88/followers","following_url":"https://api.github.com/users/ericlu88/following{/other_user}","gists_url":"https://api.github.com/users/ericlu88/gists{/gist_id}","starred_url":"https://api.github.com/users/ericlu88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericlu88/subscriptions","organizations_url":"https://api.github.com/users/ericlu88/orgs","repos_url":"https://api.github.com/users/ericlu88/repos","events_url":"https://api.github.com/users/ericlu88/events{/privacy}","received_events_url":"https://api.github.com/users/ericlu88/received_events","type":"User","site_admin":false},"body":"This PR adds subscription functions over http long-polling.\r\n\r\nServer usage:\r\n- `subscribe`: **POST** only, with JSON subscription data as request body\r\n- `poll`: **GET** only, with **pollid** specified as url arguments.\r\n  - **pollid** is an integer that serve the function of data recovery and data acknowledgement. The client start the first poll request with any arbitrary integer. The client then increment the pollid by **1** in their next poll request in order to acknowledge receiving the previous data and is ready to receive new data. If for any reason the client doesn't receive the previous data, it will make another poll request with the previous pollid, and the server will resend the same data as it did in the previous response. **Note**: Once the pollid get incremented, there's no way going back to the previous value, since the incrementation is a signal to the server to drop old data.\r\n- `unsubscribe`:\r\n  - **GET**: Will unsubscribe all active subscriptions.\r\n  - **POST**: With JSON correlation ids as request body, will only unsubscribe the specified subscriptions. The correlationIds validation logic is the same as implemented in `websocket`.\r\n- **NOTE**: The `subscription` feature only works in **HTTPS** mode, since we are using `client certificate` to map user with their session.\r\n\r\nSome implementation notes:\r\n- Add `session.ts` to create stateful **session** for our http server, which holds user specific data(subscriptions and related).\r\n- Add `session-store.ts` to hold `apiSession` and to handle session expiration\r\n- Add `api-session.ts` middleware to handle session creation and retrieval. These middleware will only be executed for subscription related route, not request/response route.\r\n- Add `buffer.ts` to handle buffer functionality(push data, get data, clear data, etc). The buffer length is constraint by a config entry. When buffer **overflow**, it will auto-shift to the latest data(ie, drop the first, add the last). The buffer class has the notion of **new** vs **old** data, which is defined as:\r\n  - New data: data that has not been retrieved. Once retrieved(through function `getNew()`), it becomes **old**\r\n  - Old data: data that has already been retrieved. \r\n- Add `subscription-buffer.ts` which extends the existing `subscription.ts` with added buffer and buffer-related functions.\r\n- Add `subscription-store-buffer.ts` which extends the existing `subscription-store.ts` with supplied `subscription-buffer.ts` as underlying store entry.\r\n- Add two test examples in `test` directory.","created_at":"2015-02-04T06:11:58Z","updated_at":"2015-02-04T21:24:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1b18afa52f11643f0c1c0ee35b019a063abc94f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44/commits","review_comments_url":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44/comments","review_comment_url":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/comments/{number}","comments_url":"https://api.github.com/repos/bloomberg/blpapi-http/issues/44/comments","statuses_url":"https://api.github.com/repos/bloomberg/blpapi-http/statuses/23bfbb3727f541de91fd1abcb18431407a328038","head":{"label":"ericlu88:long-poll","ref":"long-poll","sha":"23bfbb3727f541de91fd1abcb18431407a328038","user":{"login":"ericlu88","id":3301112,"avatar_url":"https://avatars.githubusercontent.com/u/3301112?v=3","gravatar_id":"","url":"https://api.github.com/users/ericlu88","html_url":"https://github.com/ericlu88","followers_url":"https://api.github.com/users/ericlu88/followers","following_url":"https://api.github.com/users/ericlu88/following{/other_user}","gists_url":"https://api.github.com/users/ericlu88/gists{/gist_id}","starred_url":"https://api.github.com/users/ericlu88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericlu88/subscriptions","organizations_url":"https://api.github.com/users/ericlu88/orgs","repos_url":"https://api.github.com/users/ericlu88/repos","events_url":"https://api.github.com/users/ericlu88/events{/privacy}","received_events_url":"https://api.github.com/users/ericlu88/received_events","type":"User","site_admin":false},"repo":{"id":26616463,"name":"blpapi-http","full_name":"ericlu88/blpapi-http","owner":{"login":"ericlu88","id":3301112,"avatar_url":"https://avatars.githubusercontent.com/u/3301112?v=3","gravatar_id":"","url":"https://api.github.com/users/ericlu88","html_url":"https://github.com/ericlu88","followers_url":"https://api.github.com/users/ericlu88/followers","following_url":"https://api.github.com/users/ericlu88/following{/other_user}","gists_url":"https://api.github.com/users/ericlu88/gists{/gist_id}","starred_url":"https://api.github.com/users/ericlu88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericlu88/subscriptions","organizations_url":"https://api.github.com/users/ericlu88/orgs","repos_url":"https://api.github.com/users/ericlu88/repos","events_url":"https://api.github.com/users/ericlu88/events{/privacy}","received_events_url":"https://api.github.com/users/ericlu88/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericlu88/blpapi-http","description":"HTTP wrapper for Bloomberg Open API","fork":true,"url":"https://api.github.com/repos/ericlu88/blpapi-http","forks_url":"https://api.github.com/repos/ericlu88/blpapi-http/forks","keys_url":"https://api.github.com/repos/ericlu88/blpapi-http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericlu88/blpapi-http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericlu88/blpapi-http/teams","hooks_url":"https://api.github.com/repos/ericlu88/blpapi-http/hooks","issue_events_url":"https://api.github.com/repos/ericlu88/blpapi-http/issues/events{/number}","events_url":"https://api.github.com/repos/ericlu88/blpapi-http/events","assignees_url":"https://api.github.com/repos/ericlu88/blpapi-http/assignees{/user}","branches_url":"https://api.github.com/repos/ericlu88/blpapi-http/branches{/branch}","tags_url":"https://api.github.com/repos/ericlu88/blpapi-http/tags","blobs_url":"https://api.github.com/repos/ericlu88/blpapi-http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericlu88/blpapi-http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericlu88/blpapi-http/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericlu88/blpapi-http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericlu88/blpapi-http/statuses/{sha}","languages_url":"https://api.github.com/repos/ericlu88/blpapi-http/languages","stargazers_url":"https://api.github.com/repos/ericlu88/blpapi-http/stargazers","contributors_url":"https://api.github.com/repos/ericlu88/blpapi-http/contributors","subscribers_url":"https://api.github.com/repos/ericlu88/blpapi-http/subscribers","subscription_url":"https://api.github.com/repos/ericlu88/blpapi-http/subscription","commits_url":"https://api.github.com/repos/ericlu88/blpapi-http/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericlu88/blpapi-http/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericlu88/blpapi-http/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericlu88/blpapi-http/issues/comments/{number}","contents_url":"https://api.github.com/repos/ericlu88/blpapi-http/contents/{+path}","compare_url":"https://api.github.com/repos/ericlu88/blpapi-http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericlu88/blpapi-http/merges","archive_url":"https://api.github.com/repos/ericlu88/blpapi-http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericlu88/blpapi-http/downloads","issues_url":"https://api.github.com/repos/ericlu88/blpapi-http/issues{/number}","pulls_url":"https://api.github.com/repos/ericlu88/blpapi-http/pulls{/number}","milestones_url":"https://api.github.com/repos/ericlu88/blpapi-http/milestones{/number}","notifications_url":"https://api.github.com/repos/ericlu88/blpapi-http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericlu88/blpapi-http/labels{/name}","releases_url":"https://api.github.com/repos/ericlu88/blpapi-http/releases{/id}","created_at":"2014-11-14T01:29:32Z","updated_at":"2014-11-15T17:06:32Z","pushed_at":"2015-02-04T21:21:38Z","git_url":"git://github.com/ericlu88/blpapi-http.git","ssh_url":"git@github.com:ericlu88/blpapi-http.git","clone_url":"https://github.com/ericlu88/blpapi-http.git","svn_url":"https://github.com/ericlu88/blpapi-http","homepage":null,"size":535,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bloomberg:develop","ref":"develop","sha":"a13fcc7eb8c37469f1323f17738aa4339525900c","user":{"login":"bloomberg","id":1416818,"avatar_url":"https://avatars.githubusercontent.com/u/1416818?v=3","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"repo":{"id":25042195,"name":"blpapi-http","full_name":"bloomberg/blpapi-http","owner":{"login":"bloomberg","id":1416818,"avatar_url":"https://avatars.githubusercontent.com/u/1416818?v=3","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bloomberg/blpapi-http","description":"HTTP wrapper for Bloomberg Open API","fork":false,"url":"https://api.github.com/repos/bloomberg/blpapi-http","forks_url":"https://api.github.com/repos/bloomberg/blpapi-http/forks","keys_url":"https://api.github.com/repos/bloomberg/blpapi-http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bloomberg/blpapi-http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bloomberg/blpapi-http/teams","hooks_url":"https://api.github.com/repos/bloomberg/blpapi-http/hooks","issue_events_url":"https://api.github.com/repos/bloomberg/blpapi-http/issues/events{/number}","events_url":"https://api.github.com/repos/bloomberg/blpapi-http/events","assignees_url":"https://api.github.com/repos/bloomberg/blpapi-http/assignees{/user}","branches_url":"https://api.github.com/repos/bloomberg/blpapi-http/branches{/branch}","tags_url":"https://api.github.com/repos/bloomberg/blpapi-http/tags","blobs_url":"https://api.github.com/repos/bloomberg/blpapi-http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bloomberg/blpapi-http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bloomberg/blpapi-http/git/refs{/sha}","trees_url":"https://api.github.com/repos/bloomberg/blpapi-http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bloomberg/blpapi-http/statuses/{sha}","languages_url":"https://api.github.com/repos/bloomberg/blpapi-http/languages","stargazers_url":"https://api.github.com/repos/bloomberg/blpapi-http/stargazers","contributors_url":"https://api.github.com/repos/bloomberg/blpapi-http/contributors","subscribers_url":"https://api.github.com/repos/bloomberg/blpapi-http/subscribers","subscription_url":"https://api.github.com/repos/bloomberg/blpapi-http/subscription","commits_url":"https://api.github.com/repos/bloomberg/blpapi-http/commits{/sha}","git_commits_url":"https://api.github.com/repos/bloomberg/blpapi-http/git/commits{/sha}","comments_url":"https://api.github.com/repos/bloomberg/blpapi-http/comments{/number}","issue_comment_url":"https://api.github.com/repos/bloomberg/blpapi-http/issues/comments/{number}","contents_url":"https://api.github.com/repos/bloomberg/blpapi-http/contents/{+path}","compare_url":"https://api.github.com/repos/bloomberg/blpapi-http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bloomberg/blpapi-http/merges","archive_url":"https://api.github.com/repos/bloomberg/blpapi-http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bloomberg/blpapi-http/downloads","issues_url":"https://api.github.com/repos/bloomberg/blpapi-http/issues{/number}","pulls_url":"https://api.github.com/repos/bloomberg/blpapi-http/pulls{/number}","milestones_url":"https://api.github.com/repos/bloomberg/blpapi-http/milestones{/number}","notifications_url":"https://api.github.com/repos/bloomberg/blpapi-http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bloomberg/blpapi-http/labels{/name}","releases_url":"https://api.github.com/repos/bloomberg/blpapi-http/releases{/id}","created_at":"2014-10-10T15:45:55Z","updated_at":"2015-02-04T18:51:39Z","pushed_at":"2015-02-04T18:51:39Z","git_url":"git://github.com/bloomberg/blpapi-http.git","ssh_url":"git@github.com:bloomberg/blpapi-http.git","clone_url":"https://github.com/bloomberg/blpapi-http.git","svn_url":"https://github.com/bloomberg/blpapi-http","homepage":null,"size":972,"stargazers_count":9,"watchers_count":9,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":21,"forks":11,"open_issues":21,"watchers":9,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44"},"html":{"href":"https://github.com/bloomberg/blpapi-http/pull/44"},"issue":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/issues/44"},"comments":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/bloomberg/blpapi-http/statuses/23bfbb3727f541de91fd1abcb18431407a328038"}}}}