##// END OF EJS Templates
restore websocket_url configurable...
MinRK -
Show More
@@ -128,6 +128,10 b' class IPythonHandler(AuthenticatedHandler):'
128 128 def base_url(self):
129 129 return self.settings.get('base_url', '/')
130 130
131 @property
132 def ws_url(self):
133 return self.settings.get('websocket_url', '')
134
131 135 #---------------------------------------------------------------
132 136 # Manager objects
133 137 #---------------------------------------------------------------
@@ -215,6 +219,7 b' class IPythonHandler(AuthenticatedHandler):'
215 219 def template_namespace(self):
216 220 return dict(
217 221 base_url=self.base_url,
222 ws_url=self.ws_url,
218 223 logged_in=self.logged_in,
219 224 login_available=self.login_available,
220 225 static_url=self.static_url,
@@ -172,6 +172,7 b' class NotebookWebApplication(web.Application):'
172 172
173 173 # IPython stuff
174 174 nbextensions_path = ipython_app.nbextensions_path,
175 websocket_url=ipython_app.websocket_url,
175 176 mathjax_url=ipython_app.mathjax_url,
176 177 config=ipython_app.config,
177 178 jinja2_env=env,
@@ -512,6 +513,13 b' class NotebookApp(BaseIPythonApplication):'
512 513 def _nbextensions_path_default(self):
513 514 return [os.path.join(get_ipython_dir(), 'nbextensions')]
514 515
516 websocket_url = Unicode("", config=True,
517 help="""The base URL for websockets,
518 if it differs from the HTTP server (hint: it almost certainly doesn't).
519
520 Should be in the form of an HTTP origin: ws[s]://hostname[:port]
521 """
522 )
515 523 mathjax_url = Unicode("", config=True,
516 524 help="""The url for MathJax.js."""
517 525 )
@@ -43,6 +43,7 b' require(['
43 43
44 44 var common_options = {
45 45 base_url : utils.get_body_data("baseUrl"),
46 ws_url : IPython.utils.get_body_data("wsUrl"),
46 47 notebook_path : utils.get_body_data("notebookPath"),
47 48 notebook_name : utils.get_body_data('notebookName')
48 49 };
@@ -23,6 +23,11 b' define(['
23 23 this.stdin_channel = null;
24 24 this.kernel_service_url = kernel_service_url;
25 25 this.name = name;
26 this.ws_url = IPython.utils.get_body_data("wsUrl");
27 if (!this.ws_url) {
28 // trailing 's' in https will become wss for secure web sockets
29 this.ws_url = location.protocol.replace('http', 'ws') + "//" + location.host;
30 }
26 31 this.running = false;
27 32 this.username = "username";
28 33 this.session_id = utils.uuid();
@@ -122,8 +127,6 b' define(['
122 127 console.log("Kernel started: ", json.id);
123 128 this.running = true;
124 129 this.kernel_id = json.id;
125 // trailing 's' in https will become wss for secure web sockets
126 this.ws_host = location.protocol.replace('http', 'ws') + "//" + location.host;
127 130 this.kernel_url = utils.url_path_join(this.kernel_service_url, this.kernel_id);
128 131 this.start_channels();
129 132 };
@@ -145,16 +148,16 b' define(['
145 148 Kernel.prototype.start_channels = function () {
146 149 var that = this;
147 150 this.stop_channels();
148 var ws_host_url = this.ws_host + this.kernel_url;
151 var ws_host_url = this.ws_url + this.kernel_url;
149 152 console.log("Starting WebSockets:", ws_host_url);
150 153 this.shell_channel = new this.WebSocket(
151 this.ws_host + utils.url_join_encode(this.kernel_url, "shell")
154 this.ws_url + utils.url_join_encode(this.kernel_url, "shell")
152 155 );
153 156 this.stdin_channel = new this.WebSocket(
154 this.ws_host + utils.url_join_encode(this.kernel_url, "stdin")
157 this.ws_url + utils.url_join_encode(this.kernel_url, "stdin")
155 158 );
156 159 this.iopub_channel = new this.WebSocket(
157 this.ws_host + utils.url_join_encode(this.kernel_url, "iopub")
160 this.ws_url + utils.url_join_encode(this.kernel_url, "iopub")
158 161 );
159 162
160 163 var already_called_onclose = false; // only alert once
@@ -24,6 +24,7 b' window.mathjax_url = "{{mathjax_url}}";'
24 24
25 25 data-project="{{project}}"
26 26 data-base-url="{{base_url}}"
27 data-ws-url="{{ws_url}}"
27 28 data-notebook-name="{{notebook_name}}"
28 29 data-notebook-path="{{notebook_path}}"
29 30 class="notebook_app"
General Comments 0
You need to be logged in to leave comments. Login now