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

@ -173,7 +173,10 @@ class AuthenticatedHandler(RequestHandler):
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

@ -300,6 +300,9 @@ class NotebookApp(BaseIPythonApplication):
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."""