Show More
@@ -214,15 +214,10 b' class IPythonHandler(AuthenticatedHandler):' | |||||
214 | def ws_url(self): |
|
214 | def ws_url(self): | |
215 | """websocket url matching the current request |
|
215 | """websocket url matching the current request | |
216 |
|
216 | |||
217 | turns http[s]://host[:port] into |
|
217 | By default, this is just `''`, indicating that it should match | |
218 | ws[s]://host[:port] |
|
218 | the same host, protocol, port, etc. | |
219 | """ |
|
219 | """ | |
220 | proto = self.request.protocol.replace('http', 'ws') |
|
220 | return self.settings.get('websocket_url', '') | |
221 | host = self.settings.get('websocket_host', '') |
|
|||
222 | # default to config value |
|
|||
223 | if host == '': |
|
|||
224 | host = self.request.host # get from request |
|
|||
225 | return "%s://%s" % (proto, host) |
|
|||
226 |
|
221 | |||
227 | @property |
|
222 | @property | |
228 | def mathjax_url(self): |
|
223 | def mathjax_url(self): |
@@ -425,8 +425,12 b' class NotebookApp(BaseIPythonApplication):' | |||||
425 | elif not new.endswith('/'): |
|
425 | elif not new.endswith('/'): | |
426 | self.base_kernel_url = new+'/' |
|
426 | self.base_kernel_url = new+'/' | |
427 |
|
427 | |||
428 |
websocket_ |
|
428 | websocket_url = Unicode("", config=True, | |
429 |
help="""The |
|
429 | help="""The base URL for the websocket server, | |
|
430 | if it differs from the HTTP server (hint: it almost certainly doesn't). | |||
|
431 | ||||
|
432 | Should be in the form of an HTTP origin: ws[s]://hostname[:port] | |||
|
433 | """ | |||
430 | ) |
|
434 | ) | |
431 |
|
435 | |||
432 | extra_static_paths = List(Unicode, config=True, |
|
436 | extra_static_paths = List(Unicode, config=True, |
@@ -102,7 +102,11 b' var IPython = (function (IPython) {' | |||||
102 | console.log("Kernel started: ", json.kernel_id); |
|
102 | console.log("Kernel started: ", json.kernel_id); | |
103 | this.running = true; |
|
103 | this.running = true; | |
104 | this.kernel_id = json.kernel_id; |
|
104 | this.kernel_id = json.kernel_id; | |
105 |
|
|
105 | var ws_url = json.ws_url; | |
|
106 | if (ws_url.match(/wss?:\/\//) == null) { | |||
|
107 | ws_url = "ws" + location.origin.substr(4) + ws_url; | |||
|
108 | }; | |||
|
109 | this.ws_url = ws_url; | |||
106 | this.kernel_url = this.base_url + "/" + this.kernel_id; |
|
110 | this.kernel_url = this.base_url + "/" + this.kernel_id; | |
107 | this.start_channels(); |
|
111 | this.start_channels(); | |
108 | $([IPython.events]).trigger('status_started.Kernel', {kernel: this}); |
|
112 | $([IPython.events]).trigger('status_started.Kernel', {kernel: this}); |
General Comments 0
You need to be logged in to leave comments.
Login now