Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support having different WS and HTTP urls #57

Merged
merged 2 commits into from
Dec 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nb2kg/nb2kg/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(self):
@gen.coroutine
def _connect(self, kernel_id):
ws_url = url_path_join(
KG_URL.replace('http', 'ws'),
os.getenv('KG_WS_URL', KG_URL.replace('http', 'ws')),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notebook server has a configuration option for specifying the websocket URL already:

NotebookApp.websocket_url : Unicode
Default: ''

The base URL for websockets, if it differs from the HTTP server (hint: it almost certainly doesn’t).

Should be in the form of an HTTP origin: ws[s]://hostname[:port]

https://jupyter-notebook.readthedocs.io/en/stable/config.html

You should be able to access it via self.settings['websocket_url'] in the handler class where you need it, instead of inventing a new configuration parameter. (See https://github.com/jupyter/notebook/blob/master/notebook/notebookapp.py#L266 for how that setting is populated.)

'/api/kernels',
url_escape(kernel_id),
'channels'
Expand Down