How to have multiple deep links all ending up in the same Jupyter instance?

OceanParcels has a bunch of tutorials (http://oceanparcels.org/#tutorials) that are about to be binderized. Their website has deep links to notebooks shown on nbviewer.jupyter.org and it would be great to add deep links to binder as well. If a user clicks on more than one of these deep links, they end up starting one Jupyter server per click though:

Is there any way of ensuring that they all end up in the same instance?

I don’t think there is currently a way of achieving this.

It would be interesting to think about how to do this and add support for a user to indicate their intent for “if I have a running instance of this repo already reconnect me please”

After pondering it a bit, one way to make this happen today is with a bit of JS in the website that contains the links.

Similar to https://github.com/ines/juniper or https://thebelab.readthedocs.io/en/latest/ I’d make some JS that “highjacks” the links to the binder. The first time the link is clicked the jS goes off and launches the binder and once it is ready send the user there. Then it has all the details it needs to have to check if the binder is still running or not. The next time someone clicks a binder link on your page the JS will check if the binder is still healthy and if yes redirect the user straight away. If not it’ll relaunch it, then redirect.

The problem that needs solving (I think) is that when you arrive on mybinder.org wanting to launch some repo we have no idea if you already launched this before or not. nor if it is still up or not.

I agree that one could create something with JS. But as soon as we get into “Stuff that knows about the URL you opened in a different tab”-land and hijacking of links, this starts sounding like high maintenance.

For now, I’ll recommend only having one mybinder link in the docs and a decent welcome.md to be displayed as a landing page in the running Jupyter instance.

1 Like