Skip to content

Binary websockets currently not working (easy fix) #50

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

Closed
adsche opened this issue Oct 18, 2018 · 1 comment
Closed

Binary websockets currently not working (easy fix) #50

adsche opened this issue Oct 18, 2018 · 1 comment

Comments

@adsche
Copy link
Contributor

adsche commented Oct 18, 2018

Hi,

first of all, thanks for the great project, I was halfway through implementing something similar myself when I found it.

I'm using it to proxy a VNC connection (like nbnovnc) which uses a binary websocket. I found that connection could be established but traffic would stop after the RFB handshake (which just states the protocol version in all ASCII characters).

Turns out, binary messages from the backend are not relayed properly to the frontend. The reason is https://github.com/jupyterhub/nbserverproxy/blob/master/nbserverproxy/handlers.py#L163

Similar to when proxying from frontend to backend, it should instead be:

self.ws.write_message(message, binary=type(message) is bytes)

With that, e.g., nbnovnc runs perfectly again.

Cheers!

@betatim
Copy link
Member

betatim commented Oct 18, 2018

Thanks for the debugging!

Do you want to make a PR that implements this?

I'd suggest we change type(message) is bytes to isinstance(message, bytes) which is the Python way of checking if something is an instance of a particular type in both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants