LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   WebSocket over SSH tunnel - is it possible? (https://www.linuxquestions.org/questions/linux-networking-3/websocket-over-ssh-tunnel-is-it-possible-4175530885/)

Vlad.BG 01-13-2015 08:13 AM

WebSocket over SSH tunnel - is it possible?
 
Hello,

I have a video streaming application that utilizes a WebSocket for the server <-> client communication. 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.

One way to do this is over a VPN connection, but I prefer not to use a VPN at all. That's why I decided to try and forward the communication over an SSH server via remote port forwarding.

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.

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.

Do you think it is possible to overcome this issue or should I drop the WebSocket altogether and revert to a normal HTTP / TCP connection?

Thanks!

unSpawn 01-17-2015 12:53 PM

Quote:

Originally Posted by Vlad.BG (Post 5300225)
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.

"The Internet" simply requires routable IP addresses. This means that either you're skipping over "simple" solutions like exposing the stream via a load balancer like Haproxy (it will happily use backends that have non-routable LAN IP adresses) or you are not providing us with all the details we should have.

Vlad.BG 01-18-2015 04:41 AM

Unfortunately, both the video streaming server and client will be connecting to the Internet via a mobile network, so it will not be possible to use any form of proxy between them.
At the time of writing my original post, the idea was to put the WebSocket server on the same device as the video streaming server application, which turned out to be a completely inadequate solution to the problem...

So, instead of situating my WebSocket listener on the streaming server device, I will put it in a 'mid point', where both the streaming server and clients will be able to connect (so both of them will be WebSocket clients).
A piece of software will then handle the WebSocket connections and video streaming through a basic set of API commands and hopefully I will get what I want.

This type of architecture also makes a lot more sense with regard to the original purpose of the WebSocket design.

unSpawn 01-18-2015 07:42 AM

Quote:

Originally Posted by Vlad.BG (Post 5302786)
Unfortunately, both the video streaming server and client will be connecting to the Internet via a mobile network, so it will not be possible to use any form of proxy between them.

I did not say "proxy" I said load balancer.


Quote:

Originally Posted by Vlad.BG (Post 5302786)
So, instead of situating my WebSocket listener on the streaming server device, I will put it in a 'mid point', where both the streaming server and clients will be able to connect (so both of them will be WebSocket clients).

You're essentially saying the same as I did only phrased differently ;-p


All times are GMT -5. The time now is 01:48 AM.