Accept rawChannel or url for VncScreen component
Is there an existing issue for this?
- [X] I have searched existing issues, it hasn't been reported yet
Use case description
Basically we have our own required implementation of creating a ws connection. We are not relying on third-part libraries to do it for us. It covers for us security and auth etc. noVnc package has support for accepting either url or already created ws channel to work with.
export default class RFB extends EventTargetMixin {
constructor(target, urlOrChannel, options)
So i am offering to accept not only url as string but alrerady created data channel and pass it to a rfb constructor. Wath do you think ?
Thank you!
Proposed solution (optional)
No response
Seems fair, if noVNC supports it, this library should as well. Right now, if type-safety isn't a concern, I think you can still pass a raw channell object to the url field in VncScreen and it'll still work (as is evident from the following line(s) of code).
https://github.com/roerohan/react-vnc/blob/63be97bcfc418c7bc053ca76f54bb38c29ba7c38/src/lib/VncScreen.tsx#L231
I could make a change wherein if the url is absent but a channel is present, I pass that to the RFB constructor. If both are present however, it would accept the url field. (P.S. I don't want to make it urlOrChannel since I want it to be typed distinctly). Does this solution sound good? What do you think?
@sklymoshenko could you share your thoughts on this? I'll update the source accordingly.