[python/viewer] Fallback to generic direct connection through ipykernel for Meshcat. #479
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Several limitations:
window.location.origin
is not reliable, for instance it will fail if the notebook server is hidden behind a reverse proxy, or it is embedded in a app such as VSCode. Using a tunnel and go through the usual meshcat zmq socket is an alternative solution, but it requires setting up a server or paying a service for it. Another option would be to develop a proper widget to get access to the kernel websocket through it, but it is not solution the compatibility issue with cloud notebooks providers such as deepnote, kaggle or colab.To sum up, finding a way to get access to the kernel websocket instead of opening a communication manually inside the frame seems to be necessary, but there is no way to do so by design... So being generic looks like a dead end. But the current implementation is good enough to more or less work on several platforms such as mybinder and kaggle (with a little tweak of the url origin).