r/CodingHelp • u/Doltishdp • 1d ago
[How to] Is it possible to set up a localhost server that allows WebRTC services outside your own network?
For a personal project, I needed to create a video call and screen sharing service, but to avoid paying for a server, I was wondering if it’s actually possible to run the server on localhost and have the other person connect through a Cloudflare tunnel. Do you know if this is possible? How feasible is it, and what problems might arise?
2
Upvotes
•
u/AutoModerator 1d ago
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Buttleston Professional Coder 1d ago
Yes, there are a number of services that would make it possible. ngrok is an example - it basically runs on your machine and creates a proxy between their services and your machine, assigning you a temporary address
You could probably do it with something like Tailscale if it's for demo purposes and you just need one other specific person to have access. You'd just need both your computer and theirs to be part of the same tailscale vpn (this would work with any VPN of this type)
Reading about a cloudflare tunnel, this would likely work as well, but I don't have personal experience with it
There are cloud services that have a free tier - not sure if what you want to do would fit within that, they usually allow only pretty low powered VM instances but it might work for you.
1
u/bishakhghosh_ 1d ago
Yes. For webrtc calling you just need the signalling server. You can host that locally and share that via any tunneling tool. For example if you run that on localhost:8080 then you can get a public url for it using pinggy.io by running
ssh -p 443 -R0:localhost:8080 free.pinggy.io.For STUN, there are many STUN servers available - google has some, see here https://gist.github.com/zziuni/3741933
If you are unaware of what signalling server or STUN means, you should definitely read https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling
1
u/Ronin-s_Spirit 19h ago
There are plenty of "serverless" services with a small free plan, there is also Oracle Cloud with a whole VPS for free, which is quite generous.