feat(vncscreen.tsx): supports a websocket instance as prop which may be pre-authenticated#71
Conversation
…be pre-authenticated Currently, `react-vnc` requires a WebSocket URL and handles the connection internally. However, many VNC servers require custom authentication flows (cookie-based auth, token-based auth, MessagePack handshakes, etc.) that must be completed before the VNC protocol can begin.
|
I'll note that this change works already in our local code. The websocket is already pre-existing and re-used for multiple connections through a web interface including SSH and file transfers. Tried to implement novnc directly but that failed miserably, so honestly, patching react-vnc was the easiest course of action. Since it's not a breaking change and just offers more functionality I thought I'd contribute back the change. As of now we've published the patched version in our internal npm repository, but if this PR is merged and released we'll be able to keep using real-vnc directly from npm, so we get security patches and updates. That would definitely be the preferred course of action :D |
|
@eslachance I really appreciate the contribution! This PR looks good to me, I'll merge it and release a new version. |
|
🎉 This PR is included in version 3.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
Awesome, thank you very much for the quick turnaround! Just verified updating works perfectly fine in our implementation. |
Description
Currently,
react-vncrequires a WebSocket URL and handles the connection internally. However, many VNC servers require custom authentication flows (cookie-based auth, token-based auth, MessagePack handshakes, etc.) that must be completed before the VNC protocol can begin.This enhancement allows users to:
API Changes
Added a new optional prop
websocketto theVncScreencomponent:urlorwebsocketmust be providedwebsocketis provided, it takes precedence overurlurlcontinues to work unchangedImplementation Details
RFBinitialization to accept either URL string or WebSocket instance (noVNC already supports both)Before submitting the PR, please take the following into consideration
feat:,fix:,chore:,docs:, orrefactor:.mainbranch.