{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments/53884493","id":53884493,"diff_hunk":"@@ -0,0 +1,87 @@\n+// Copyright (c) Microsoft Corporation. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for details.\n+\n+import * as em from \"../common/extensionMessaging\";\n+import * as http from \"http\";\n+import * as vscode from \"vscode\";\n+import * as Q from \"q\";\n+\n+export class ExtensionServer implements vscode.Disposable {\n+\n+    private serverInstance: http.Server = null;\n+\n+    /**\n+     * Starts the server.\n+     */\n+    public setup(): Q.Promise<void> {\n+\n+        let deferred = Q.defer<void>();\n+\n+        let requestHandler = (request: http.IncomingMessage, response: http.ServerResponse) => {\n+            this.handleIncomingMessage(request, response);\n+        };\n+\n+        let launchCallback = (error: any) => {\n+            if (error) {\n+                deferred.reject(error);\n+            } else {\n+                deferred.resolve(null);\n+            }\n+        };\n+\n+        this.serverInstance = http.createServer(requestHandler);\n+        this.serverInstance.listen(em.ServerParams.PORT, null, null, launchCallback);\n+\n+        return deferred.promise;\n+    }\n+\n+    /**\n+     * Stops the server.\n+     */\n+    public dispose(): void {\n+        if (this.serverInstance) {\n+            this.serverInstance.close();\n+        }","path":"src/extension/extensionServer.ts","position":44,"original_position":44,"commit_id":"0502b7a86030ea91bf3320d0f2ad32aff86fa6db","original_commit_id":"0502b7a86030ea91bf3320d0f2ad32aff86fa6db","user":{"login":"digeff","id":14098140,"avatar_url":"https://avatars.githubusercontent.com/u/14098140?v=3","gravatar_id":"","url":"https://api.github.com/users/digeff","html_url":"https://github.com/digeff","followers_url":"https://api.github.com/users/digeff/followers","following_url":"https://api.github.com/users/digeff/following{/other_user}","gists_url":"https://api.github.com/users/digeff/gists{/gist_id}","starred_url":"https://api.github.com/users/digeff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digeff/subscriptions","organizations_url":"https://api.github.com/users/digeff/orgs","repos_url":"https://api.github.com/users/digeff/repos","events_url":"https://api.github.com/users/digeff/events{/privacy}","received_events_url":"https://api.github.com/users/digeff/received_events","type":"User","site_admin":false},"body":"I'd assign null to serverInstance after we close it, just to have 2 possible states in the object (null or non-null and opened).","created_at":"2016-02-24T02:09:37Z","updated_at":"2016-02-24T02:09:37Z","html_url":"https://github.com/Microsoft/vscode-react-native/pull/76#discussion_r53884493","pull_request_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments/53884493"},"html":{"href":"https://github.com/Microsoft/vscode-react-native/pull/76#discussion_r53884493"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76","id":60419440,"html_url":"https://github.com/Microsoft/vscode-react-native/pull/76","diff_url":"https://github.com/Microsoft/vscode-react-native/pull/76.diff","patch_url":"https://github.com/Microsoft/vscode-react-native/pull/76.patch","issue_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/76","number":76,"state":"open","locked":false,"title":"Initial work for extension process hosted server.","user":{"login":"dlebu","id":12283206,"avatar_url":"https://avatars.githubusercontent.com/u/12283206?v=3","gravatar_id":"","url":"https://api.github.com/users/dlebu","html_url":"https://github.com/dlebu","followers_url":"https://api.github.com/users/dlebu/followers","following_url":"https://api.github.com/users/dlebu/following{/other_user}","gists_url":"https://api.github.com/users/dlebu/gists{/gist_id}","starred_url":"https://api.github.com/users/dlebu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlebu/subscriptions","organizations_url":"https://api.github.com/users/dlebu/orgs","repos_url":"https://api.github.com/users/dlebu/repos","events_url":"https://api.github.com/users/dlebu/events{/privacy}","received_events_url":"https://api.github.com/users/dlebu/received_events","type":"User","site_admin":false},"body":"Sending out this PR for design review. Please take a look and let me know if the current infrastructure supports all our future scenarios.\r\n\r\n@MSLaguana @meenakb @digeff @MShamiltonia ","created_at":"2016-02-23T22:13:47Z","updated_at":"2016-02-24T02:09:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"50c7db226072ba216c8edc172c49592f1649c37a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76/commits","review_comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76/comments","review_comment_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/76/comments","statuses_url":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/0502b7a86030ea91bf3320d0f2ad32aff86fa6db","head":{"label":"Microsoft:move-packager","ref":"move-packager","sha":"0502b7a86030ea91bf3320d0f2ad32aff86fa6db","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":50060429,"name":"vscode-react-native","full_name":"Microsoft/vscode-react-native","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/vscode-react-native","description":"vscode extension for react native","fork":false,"url":"https://api.github.com/repos/Microsoft/vscode-react-native","forks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/forks","keys_url":"https://api.github.com/repos/Microsoft/vscode-react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vscode-react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vscode-react-native/teams","hooks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/events","assignees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vscode-react-native/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/tags","blobs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vscode-react-native/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscription","commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vscode-react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vscode-react-native/merges","archive_url":"https://api.github.com/repos/Microsoft/vscode-react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vscode-react-native/downloads","issues_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vscode-react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vscode-react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vscode-react-native/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vscode-react-native/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/deployments","created_at":"2016-01-20T21:10:07Z","updated_at":"2016-02-24T02:08:11Z","pushed_at":"2016-02-24T00:12:04Z","git_url":"git://github.com/Microsoft/vscode-react-native.git","ssh_url":"git@github.com:Microsoft/vscode-react-native.git","clone_url":"https://github.com/Microsoft/vscode-react-native.git","svn_url":"https://github.com/Microsoft/vscode-react-native","homepage":null,"size":3056,"stargazers_count":45,"watchers_count":45,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":15,"forks":0,"open_issues":15,"watchers":45,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"1885539ac62ee3152d8a1c7eda76a2e5aba3d7e9","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":50060429,"name":"vscode-react-native","full_name":"Microsoft/vscode-react-native","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/vscode-react-native","description":"vscode extension for react native","fork":false,"url":"https://api.github.com/repos/Microsoft/vscode-react-native","forks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/forks","keys_url":"https://api.github.com/repos/Microsoft/vscode-react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vscode-react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vscode-react-native/teams","hooks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/events","assignees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vscode-react-native/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/tags","blobs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vscode-react-native/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscription","commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vscode-react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vscode-react-native/merges","archive_url":"https://api.github.com/repos/Microsoft/vscode-react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vscode-react-native/downloads","issues_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vscode-react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vscode-react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vscode-react-native/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vscode-react-native/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/deployments","created_at":"2016-01-20T21:10:07Z","updated_at":"2016-02-24T02:08:11Z","pushed_at":"2016-02-24T00:12:04Z","git_url":"git://github.com/Microsoft/vscode-react-native.git","ssh_url":"git@github.com:Microsoft/vscode-react-native.git","clone_url":"https://github.com/Microsoft/vscode-react-native.git","svn_url":"https://github.com/Microsoft/vscode-react-native","homepage":null,"size":3056,"stargazers_count":45,"watchers_count":45,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":15,"forks":0,"open_issues":15,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76"},"html":{"href":"https://github.com/Microsoft/vscode-react-native/pull/76"},"issue":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/76"},"comments":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/0502b7a86030ea91bf3320d0f2ad32aff86fa6db"}}}}