Tunneling with SSH
Set up an SSH tunnel to connect ComfyStream UI to ComfyStream when using a TURN server
TURN Server Setup
When and why is this needed?
RunPod and many other cloud providers have restrictive network policies that can block direct streaming connections. The TURN server acts as a trusted intermediary that can relay the streaming data between your local machine and the server. Additionally, if direct UDP connections fail (common with corporate/cloud environments), the TURN server can fall back to TCP, making the connection more reliable. To use a TURN server in this set up, follow the steps below:
- Create a Twilio account at twilio.com
- Get credentials from console.twilio.com
- Take note of your
ACCOUNT SID
andAUTH TOKEN
for use in the next section of this document
Alternatively you can use tunneling with SSH
Setting up SSH Tunneling
Tunnel to open up UDP connection
- On the remote server (remote_host), run:
- On the local machine, Open an SSH tunnel
- On the local machine, run
Traffic sent to localhost:1234 on the local machine will be forwarded over the SSH tunnel and will reach 127.0.0.1:5678 on the remote server
Open another terminal, ssh into the remote SSH terminal:
- You should find “SSH over exposed TCP” value in Runpod
- Copy that command, and
add -L 8889:localhost:8889
- For example:
ssh -L 8889:localhost:8889 root@{runpod_ip} -p 16974 -i ~/.ssh/id_ed25519
- For example:
8889 is the port that ComfyStream is listening on at the remote server