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

Custom Websocket url differ in JupyterLab and Jupyter Notebook Server #7087

Closed
sntgluca opened this issue Aug 26, 2019 · 3 comments
Closed
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

Comments

@sntgluca
Copy link

sntgluca commented Aug 26, 2019

Dear all,

While searching for a workaround on another issue, I encountered a mismatch in the behaviour of JupyterLab and Jupyter Notebook server.
I post it here, as I think this is the most sensible place to discuss this, although it has partially to do with JupyterHub as well.

The mismatch is in the setup of the custom websocket_url parameter. It can be replicated with this minimal JupyterHub configuration:

c.JupyterHub.base_url = <BASE_URL>
c.Spawner.websocket_url = "ws://<ADDRESS>/<BASE_URL>"

where BASE_URL and<ADDRESS> are the custom url and location of my choice.
The final websocket address should have the form ws://<ADDRESS>/<BASE_URL>/user/{username}

The final websocket url built by the backend Jupyter session has the form

  • ws://<ADDRESS>/<BASE_URL> in JupyterLab
  • ws://<ADDRESS>/<BASE_URL>/user/{username} in Jupyter Notebook Server

This inconsistency is problematic, because I cannot customise the websocket_url parameter in a way that works for both JupyterLab and Jupyter Notebook server.
How would you address this problem?

Thanks
Gianluca

@sntgluca
Copy link
Author

A quick answer about this, in case someone else came across the same problem.

Using notebook version 6.0.0, the web url is defined, for the traditional notebook server, in the file notebook/static/notebook/js/main.min.js

Adding the following lines in row 50727

+        this.ws_url = this.ws_url.replace(/^((?:\w+:)?\/\/(.+:\d+))(.*)/, '$1');
+        that.ws_url = that.ws_url.replace(/^((?:\w+:)?\/\/(.+:\d+))(.*)/, '$1');

removes the duplication from the notebook server websocket url, hence making both JupyterLab and Jupyter Notebook server behaving in the same way.

@jasongrout
Copy link
Contributor

Which behavior do you think is more correct?

@sntgluca
Copy link
Author

Hi @jasongrout !
I don't think there's an obvious answer to your question.

I found that modifying the notebook package's code was easier, and I considering JupyterLab is the default. Do you consider the patch above good enough?

The only argument for keeping the notebook package behaviour is that it seems simpler (as in, it doesn't strip arguments from the url). But I don't consider this a strong point.

@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Oct 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

2 participants