{"action":"created","comment":{"url":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/comments/33095287","id":33095287,"diff_hunk":"@@ -0,0 +1,1073 @@\n+// Copyright (c) Jupyter Development Team.\n+// Distributed under the terms of the Modified BSD License.\n+\n+\"use strict\";\n+\n+import $ = require('jquery');\n+import utils = require('base/js/utils');\n+import comm = require('./comm');\n+import serialize = require('./serialize');\n+import events = require('base/js/events');\n+\n+\n+/**\n+     * A Kernel class to communicate with the Python kernel. This\n+     * should generally not be constructed directly, but be created\n+     * by.  the `Session` object. Once created, this object should be\n+     * used to communicate with the kernel.\n+     * \n+     * @class Kernel\n+     * @param {string} kernel_service_url - the URL to access the kernel REST api\n+     * @param {string} ws_url - the websockets URL\n+     * @param {string} name - the kernel type (e.g. python3)\n+     */\n+export class Kernel {\n+\n+    constructor(kernel_service_url: string, ws_url: string, name: string) {\n+\n+        this.id = null;\n+        this.name = name;\n+        this.ws = null;\n+\n+        this.kernel_service_url = kernel_service_url;\n+        this.kernel_url = null;\n+        this.ws_url = ws_url || utils.get_body_data(\"wsUrl\");\n+        if (!this.ws_url) {\n+            // trailing 's' in https will become wss for secure web sockets\n+            this.ws_url = location.protocol.replace('http', 'ws') + \"//\" + location.host;\n+        }\n+\n+        this.username = \"username\";\n+        this.session_id = utils.uuid();\n+        this._msg_callbacks = {};\n+        this._msg_queue = Promise.resolve();\n+        this.info_reply = {}; // kernel_info_reply stored here after starting\n+\n+        if (typeof(WebSocket) !== 'undefined') {\n+            this.WebSocket = WebSocket;\n+        } else if (typeof(MozWebSocket) !== 'undefined') {\n+            this.WebSocket = MozWebSocket;\n+        } else {\n+            alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox ≥ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.');\n+        }\n+        \n+        this.bind_events();\n+        this.init_iopub_handlers();\n+        this.comm_manager = new comm.CommManager(this);\n+        \n+        this.last_msg_id = null;\n+        this.last_msg_callbacks = {};\n+\n+        this._autorestart_attempt = 0;\n+        this._reconnect_attempt = 0;\n+        this.reconnect_limit = 7;\n+    };\n+\n+    /**\n+     * @function _get_msg\n+     */\n+    _get_msg(msg_type: string, content, metadata?, buffers?): any {","path":"src/kernel.ts","position":69,"original_position":69,"commit_id":"011ce65ae24face5adaa5d2bf0fda1168903e47d","original_commit_id":"011ce65ae24face5adaa5d2bf0fda1168903e47d","user":{"login":"jasongrout","id":192614,"avatar_url":"https://avatars.githubusercontent.com/u/192614?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongrout","html_url":"https://github.com/jasongrout","followers_url":"https://api.github.com/users/jasongrout/followers","following_url":"https://api.github.com/users/jasongrout/following{/other_user}","gists_url":"https://api.github.com/users/jasongrout/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongrout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongrout/subscriptions","organizations_url":"https://api.github.com/users/jasongrout/orgs","repos_url":"https://api.github.com/users/jasongrout/repos","events_url":"https://api.github.com/users/jasongrout/events{/privacy}","received_events_url":"https://api.github.com/users/jasongrout/received_events","type":"User","site_admin":false},"body":"We have default values in typescript/es6, let's use them.  `metadata = {}, buffers = []`","created_at":"2015-06-23T21:33:33Z","updated_at":"2015-06-23T21:33:33Z","html_url":"https://github.com/jasongrout/phosphor-notebook/pull/1#discussion_r33095287","pull_request_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/comments/33095287"},"html":{"href":"https://github.com/jasongrout/phosphor-notebook/pull/1#discussion_r33095287"},"pull_request":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1","id":38251042,"html_url":"https://github.com/jasongrout/phosphor-notebook/pull/1","diff_url":"https://github.com/jasongrout/phosphor-notebook/pull/1.diff","patch_url":"https://github.com/jasongrout/phosphor-notebook/pull/1.patch","issue_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/issues/1","number":1,"state":"closed","locked":false,"title":"Add kernel.ts","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-22T16:38:17Z","updated_at":"2015-06-23T21:33:33Z","closed_at":"2015-06-22T19:30:24Z","merged_at":"2015-06-22T19:30:24Z","merge_commit_sha":"05d1b0330ea37cd4674bb56f7702d617be9f5132","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1/commits","review_comments_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1/comments","review_comment_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/issues/1/comments","statuses_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/statuses/011ce65ae24face5adaa5d2bf0fda1168903e47d","head":{"label":"blink1073:kernel_ts","ref":"kernel_ts","sha":"011ce65ae24face5adaa5d2bf0fda1168903e47d","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"repo":{"id":37856367,"name":"phosphor-notebook","full_name":"blink1073/phosphor-notebook","owner":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/blink1073/phosphor-notebook","description":"","fork":true,"url":"https://api.github.com/repos/blink1073/phosphor-notebook","forks_url":"https://api.github.com/repos/blink1073/phosphor-notebook/forks","keys_url":"https://api.github.com/repos/blink1073/phosphor-notebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blink1073/phosphor-notebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blink1073/phosphor-notebook/teams","hooks_url":"https://api.github.com/repos/blink1073/phosphor-notebook/hooks","issue_events_url":"https://api.github.com/repos/blink1073/phosphor-notebook/issues/events{/number}","events_url":"https://api.github.com/repos/blink1073/phosphor-notebook/events","assignees_url":"https://api.github.com/repos/blink1073/phosphor-notebook/assignees{/user}","branches_url":"https://api.github.com/repos/blink1073/phosphor-notebook/branches{/branch}","tags_url":"https://api.github.com/repos/blink1073/phosphor-notebook/tags","blobs_url":"https://api.github.com/repos/blink1073/phosphor-notebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blink1073/phosphor-notebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blink1073/phosphor-notebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/blink1073/phosphor-notebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blink1073/phosphor-notebook/statuses/{sha}","languages_url":"https://api.github.com/repos/blink1073/phosphor-notebook/languages","stargazers_url":"https://api.github.com/repos/blink1073/phosphor-notebook/stargazers","contributors_url":"https://api.github.com/repos/blink1073/phosphor-notebook/contributors","subscribers_url":"https://api.github.com/repos/blink1073/phosphor-notebook/subscribers","subscription_url":"https://api.github.com/repos/blink1073/phosphor-notebook/subscription","commits_url":"https://api.github.com/repos/blink1073/phosphor-notebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/blink1073/phosphor-notebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/blink1073/phosphor-notebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/blink1073/phosphor-notebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/blink1073/phosphor-notebook/contents/{+path}","compare_url":"https://api.github.com/repos/blink1073/phosphor-notebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blink1073/phosphor-notebook/merges","archive_url":"https://api.github.com/repos/blink1073/phosphor-notebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blink1073/phosphor-notebook/downloads","issues_url":"https://api.github.com/repos/blink1073/phosphor-notebook/issues{/number}","pulls_url":"https://api.github.com/repos/blink1073/phosphor-notebook/pulls{/number}","milestones_url":"https://api.github.com/repos/blink1073/phosphor-notebook/milestones{/number}","notifications_url":"https://api.github.com/repos/blink1073/phosphor-notebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blink1073/phosphor-notebook/labels{/name}","releases_url":"https://api.github.com/repos/blink1073/phosphor-notebook/releases{/id}","created_at":"2015-06-22T13:22:15Z","updated_at":"2015-06-22T13:22:16Z","pushed_at":"2015-06-22T16:38:04Z","git_url":"git://github.com/blink1073/phosphor-notebook.git","ssh_url":"git@github.com:blink1073/phosphor-notebook.git","clone_url":"https://github.com/blink1073/phosphor-notebook.git","svn_url":"https://github.com/blink1073/phosphor-notebook","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":"jasongrout:master","ref":"master","sha":"bc8ce2024593a54a3aaa8480f671257584c00153","user":{"login":"jasongrout","id":192614,"avatar_url":"https://avatars.githubusercontent.com/u/192614?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongrout","html_url":"https://github.com/jasongrout","followers_url":"https://api.github.com/users/jasongrout/followers","following_url":"https://api.github.com/users/jasongrout/following{/other_user}","gists_url":"https://api.github.com/users/jasongrout/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongrout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongrout/subscriptions","organizations_url":"https://api.github.com/users/jasongrout/orgs","repos_url":"https://api.github.com/users/jasongrout/repos","events_url":"https://api.github.com/users/jasongrout/events{/privacy}","received_events_url":"https://api.github.com/users/jasongrout/received_events","type":"User","site_admin":false},"repo":{"id":37687249,"name":"phosphor-notebook","full_name":"jasongrout/phosphor-notebook","owner":{"login":"jasongrout","id":192614,"avatar_url":"https://avatars.githubusercontent.com/u/192614?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongrout","html_url":"https://github.com/jasongrout","followers_url":"https://api.github.com/users/jasongrout/followers","following_url":"https://api.github.com/users/jasongrout/following{/other_user}","gists_url":"https://api.github.com/users/jasongrout/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongrout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongrout/subscriptions","organizations_url":"https://api.github.com/users/jasongrout/orgs","repos_url":"https://api.github.com/users/jasongrout/repos","events_url":"https://api.github.com/users/jasongrout/events{/privacy}","received_events_url":"https://api.github.com/users/jasongrout/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jasongrout/phosphor-notebook","description":"IPython notebook reboot","fork":false,"url":"https://api.github.com/repos/jasongrout/phosphor-notebook","forks_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/forks","keys_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/teams","hooks_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/hooks","issue_events_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/issues/events{/number}","events_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/events","assignees_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/assignees{/user}","branches_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/branches{/branch}","tags_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/tags","blobs_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/statuses/{sha}","languages_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/languages","stargazers_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/stargazers","contributors_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/contributors","subscribers_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/subscribers","subscription_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/subscription","commits_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/contents/{+path}","compare_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/merges","archive_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/downloads","issues_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/issues{/number}","pulls_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls{/number}","milestones_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/milestones{/number}","notifications_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/labels{/name}","releases_url":"https://api.github.com/repos/jasongrout/phosphor-notebook/releases{/id}","created_at":"2015-06-18T21:53:23Z","updated_at":"2015-06-23T21:00:16Z","pushed_at":"2015-06-23T19:44:16Z","git_url":"git://github.com/jasongrout/phosphor-notebook.git","ssh_url":"git@github.com:jasongrout/phosphor-notebook.git","clone_url":"https://github.com/jasongrout/phosphor-notebook.git","svn_url":"https://github.com/jasongrout/phosphor-notebook","homepage":"","size":0,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1"},"html":{"href":"https://github.com/jasongrout/phosphor-notebook/pull/1"},"issue":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/issues/1"},"comments":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/jasongrout/phosphor-notebook/statuses/011ce65ae24face5adaa5d2bf0fda1168903e47d"}}}}