

So, if I want to make this work I will have to build a second SSH tunnel from the WebSocket client, in an attempt to bridge the SSH generated client socket to the original one, which makes this a somewhat complicated task. What makes it even worse is that SSH will open yet another TCP socket (again on a random port) which will be then used to forward the client's request to the actual WebSocket server over the SSH tunnel.
Websocket ssh tunnel how to#
The problem is that the WebSocket client will always allocate a random port when initializing the communication and the SSH-relay point has no idea how to handle the responses coming from the server on that port. on two devices accessing the Internet through a mobile data connection) (in the case when the server is behind a router or firewall and using standard NAT forwarding / routing is not an option - e.g. My idea is to be able to indirectly access the WebSocket server by forwarding it's listening port to a machine with a real IP address. The setup is quite simple actually - there is a WebSocket server and a WebSocket client connecting to it. When the SSH relay point receives the responses from the streaming server it does not automatically route them back to the client and the WebSocket handshake cannot be completed.ĭo you think it is possible to overcome this issue or should I drop the WebSocket altogether and revert to a normal HTTP / TCP connection? However I am facing an issue - forwarding the server socket is pretty straight-forward, but I have no way to know in advance what the randomly allocated client port will be, so the traffic will flow only in the direction client -> SSH server -> streaming server. That's why I decided to try and forward the communication over an SSH server via remote port forwarding. One way to do this is over a VPN connection, but I prefer not to use a VPN at all. My goal is to make the video streaming service available over the internet in the cases where neither the server nor client have public IPs. I have a video streaming application that utilizes a WebSocket for the server client communication.
