pass ws_url to kernel constructor

via session constructor via notebook constructor…
MinRK 12 years ago
parent 579f5101f0
commit 137f98014a

@ -59,6 +59,7 @@ define([
this.keyboard_manager = options.keyboard_manager;
this.save_widget = options.save_widget;
this.tooltip = new tooltip.Tooltip(this.events);
this.ws_url = options.ws_url;
// default_kernel_name is a temporary measure while we implement proper
// kernel selection and delayed start. Do not rely on it.
this.default_kernel_name = 'python';
@ -1496,6 +1497,7 @@ define([
Notebook.prototype.start_session = function () {
this.session = new session.Session({
base_url: this.base_url,
ws_url: this.ws_url,
notebook_path: this.notebook_path,
notebook_name: this.notebook_name,
// For now, create all sessions with the 'python' kernel, which is the

@ -15,7 +15,7 @@ define([
* A Kernel Class to communicate with the Python kernel
* @Class Kernel
*/
var Kernel = function (kernel_service_url, notebook, name) {
var Kernel = function (kernel_service_url, ws_url, notebook, name) {
this.events = notebook.events;
this.kernel_id = null;
this.shell_channel = null;
@ -23,7 +23,7 @@ define([
this.stdin_channel = null;
this.kernel_service_url = kernel_service_url;
this.name = name;
this.ws_url = IPython.utils.get_body_data("wsUrl");
this.ws_url = ws_url || IPython.utils.get_body_data("wsUrl");
if (!this.ws_url) {
// trailing 's' in https will become wss for secure web sockets
this.ws_url = location.protocol.replace('http', 'ws') + "//" + location.host;

@ -17,6 +17,7 @@ define([
this.path = options.notebook_path;
this.kernel_name = options.kernel_name;
this.base_url = options.base_url;
this.ws_url = options.ws_url;
};
Session.prototype.start = function(callback) {
@ -91,7 +92,7 @@ define([
Session.prototype._handle_start_success = function (data, status, xhr) {
this.id = data.id;
var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels");
this.kernel = new kernel.Kernel(kernel_service_url, this.notebook, this.kernel_name);
this.kernel = new kernel.Kernel(kernel_service_url, this.ws_url, this.notebook, this.kernel_name);
this.kernel._kernel_started(data.kernel);
};

Loading…
Cancel
Save