Did you ever feel, although you wanted to set up a
WebRTC service on your own, that the
VPS had been blended? Been there, done that with heaps of trial and error and a few what the heck moments. But once it's digitally on,
WebRTC server on a
VPS is quite good. Let me tell you how.
Choose the Right VPS
Not all
VPS servers are the same. For
WebRTC, you will have to choose a server with a fast response time and enough
CPU power to serve several users.
VPS with dedicated
CPU cores are my favorites-something I think helps a lot when many people want to hit video calls at the same time.
•
CPU & RAM: At least
2-4 CPU cores and
4GB RAM for small projects.
•
Internet speed: A large speed bandwidth is important. Slow servers lag behind and cause lags in calls.
•
Server location: For speed, find a server in someone else's neighborhood.
Setting up WebRTC
Now that you have the basic framework in place, everything else will become a relative breeze. Here are some requirements:
1.
Signaling Server: Handles the connection between users. You can code it in
Node.js or
Python.
2.
STUN/TURN Servers: These are necessary to connect users via firewalls.
STUN will do for debugging/testing purposes, but
TURN should be considered for serious real-world use.
3.
Modifying Broadcast Streams: You can use
Kurento or
Jitsi media server for recording or mixing streams.
I had a go at running some calls by skipping the
TURN servers and sticking with
STUN only—calls ended up in disaster in some networks. Don't even think about it.
Speeding Things Up
You can enhance your VPS without really spending on an upgrade. Here are some things that help me:
- Use WebSockets wisely— No message spamming.
- Audio/video compression— Fewer bytes, faster going.
- CPU and memory usage— Relative server load.