TCP Socket to Websocket?

后端 未结 3 1973
一生所求
一生所求 2021-02-20 06:07

There are plenty of websocket -> socket wrappers around there (like websockify) but is there an opposite available out there? Specifically, I want to be able to connect to a TCP

3条回答
  •  终归单人心
    2021-02-20 06:51

    I am not sure what u were looking for but in case that helps someone in the future I will write what I did to solve my problem.

    My problem: I wanted to be able to host noVNC on my web application's server and I wanted non websocket vnc servers to be able to understand it without using websockify.

    My solution: I used ws-tcp-bridge node.js module to bridge the websocket port<--lport> where the noVNC client would connect to with the vnc tcp server's host.

    Example: This happens by running the following command from the vncserver's machine:

    ws-tcp-bridge --method=ws2tcp --lport=5555 --rhost=127.0.0.1:5902

    That way I was able to host a non websocket vncserver at port 5902 and connect with it via noVNC at port 5555.

    Haven't tested this very much but works very well with x11vnc vnc server.

提交回复
热议问题