let websocket server be traited config option

This commit is contained in:
Andrew Straw 2012-01-28 13:24:52 +01:00
parent bd7f1f941c
commit 332fdf662c
2 changed files with 9 additions and 3 deletions

View File

@ -168,12 +168,15 @@ class AuthenticatedHandler(RequestHandler):
@property
def ws_url(self):
"""websocket url matching the current request
turns http[s]://host[:port] into
ws[s]://host[:port]
"""
proto = self.request.protocol.replace('http', 'ws')
return "%s://%s" % (proto, self.request.host)
host = self.application.ipython_app.websocket_host # default to config value
if host == '':
host = self.request.host # get from request
return "%s://%s" % (proto, host)
class AuthenticatedFileHandler(AuthenticatedHandler, web.StaticFileHandler):

View File

@ -295,11 +295,14 @@ class NotebookApp(BaseIPythonApplication):
"""set mathjax url to empty if mathjax is disabled"""
if not new:
self.mathjax_url = u''
base_project_url = Unicode('/', config=True,
help='''The base URL for the notebook server''')
base_kernel_url = Unicode('/', config=True,
help='''The base URL for the kernel server''')
websocket_host = Unicode("", config=True,
help="""The hostname for the websocket server."""
)
mathjax_url = Unicode("", config=True,
help="""The url for MathJax.js."""