WebRTC isn’t limited to JavaScript.
This is something I don’t get asked directly, but it does pop up from time to time. Especially when people come up with a specific language in mind and ask if it is suitable for WebRTC.
While the answer is almost always yes, I think a quick explanation of where programming languages meet WebRTC exactly is in order.
We will start with a small “diagram”, to show where we can find WebRTC related entities and move from there.
We’ve got both client and server entities with WebRTC, and I think the above depicts the main ones. There are more as your service gets more complicated, but that’s all an issue of scaling and pure development not directly related to WebRTC.
Want to learn more about WebRTC server requirements and specifications? Enroll now to my 3-part video mini-course for free:
So what do we have here?
Web app
The web app is what most people think about when they think WebRTC.
This is what ends up running in the browser, loaded from an HTML and its derivatives.
What this means is that the language you end up with is Java Script.
Mobile app
When it comes to the mobile domain, there are two ways to end up with WebRTC. The first is by having the web app served inside a mobile browser, which brings you back to Java Script.
The more common approach though is to use WebRTC inside an app. You end up compiling and linking the WebRTC codebase as an SDK.
The languages here?
- C, C++ for the low level stuff that makes up WebRTC. In all likelihood, you won’t need to handle this (either because it will just work or because you’ll be outsourcing it to someone else)
- Java for native Android app development
- Objective-C and/or Switft for native iOS app development
There’s also the alternative of C# via Xamarin or Java Script again if you use something like Crosswalk. With these approaches, someone should already have WebRTC wrapped for you in these platforms.
Embedded app
Embedded is where things get interesting.
There are cases where you want devices to run WebRTC for one reason or another.
Two main approaches here will dictate the languages of choice:
- C, C++ if you port the webrtc.org code base and use it. And then whatever else you fancy on top of it
- Any language you wish (Java anyone?), while implementing what you need of the WebRTC protocol (=what goes on the network) on your own
In general, here you’ll be going to lower levels of abstraction, getting as close as possible to the machine language (but stopping at C most probably).
TURN server
STUN and TURN servers are also necessary. Most likely – you won’t be needing to do a thing about them besides compiling, configuring and running them.
So no programming languages here.
I would note that the popular open source alternatives are all written in C. Again – this doesn’t matter.
Media server
Media servers come in different shapes and sizes. I’ve covered them here recently, discussing Jitsi/Kurento and later Kurento/Janus.
The programming languages here depend on the media server itself. Jitsi is primarily Java based. Kurento is written in C/C++ with front ends typically written in Java or Node.js. Janus is mostly C. In most cases – you wouldn’t care.
Media servers are usually entities that you communicate with via REST or Websocket, so you can just use whatever language you like on the controlling side. It is a very popular choice to juse Node.js (=Java Script) in front of a Kurento server for example. It also brings us to the last entity.
App/Signaling server
The funny thing is that this is where the question is mostly targeted at. The application and/or signaling server is what stitches everything together. It serves the web app, communicates with the mobile and embedded apps. It offers the details of the TURN server and handles any ephemeral passwords with it, it controls the media servers.
And it is also where the bulk of the development happens since it holds the business logic of the application.
And here the answer is rather simple – use whatever you want.
- Node.js and Java Script are great and popular choice (there are good reasons for that)
- Java seems to be a thing in enterprises though for the life of me I just can’t understand why
- PHP works well. It is used by many WordPress plugins for WebRTC
- Erlang seems to be something that adventurous developers like to adopt – and like
- Ruby and Python are also good choices
- .Net is something I’ve seen once or twice used
In general, whatever you can use to build websites can be used to build a WebRTC service.
What’s your language?
Back to you. What is the programming languages you use with WebRTC?
If you are looking for developers, then what would be the languages you’d view as mandatory and which ones as preferable with applicants?
–
This as well as other topics are covered in my upcoming Advanced WebRTC Architecture course. Be sure to enroll if you wish to deepen your understanding in this topic.
Tsahi,
Thanks again for a great post. Just for accuracy, Kurento is fully written in C/C++. Application developers can consume Kurento capabilities using Java and JavaScript SDKs, which built proxies that speak a protocol with the media server. However, Kurento itself is not written in Java. In fact, there is not a single line of Java code inside Kurento Media Server.
Oops. Sorry for missing that one – you should probably update your documentation a bit to be more clear about this as well.
Will fix this article to fit.
Signaling server in PHP?! I haven’t seen any.
IMO Go is probably one of the best options these days for a signaling server (a mix with the best parts of python, c and erlang). And in the JVM side Java or Scala with one of the cool frameworks (Akka, vert.x…)
Well… PHP will usually be used as the application server, connecting it to a signaling server which predominantly will be based on Node. I am sure that someone figured out how to PHP his way to WebRTC.
Go is something I’ve seen discussed but never used with WebRTC. Would like to see it adopted more as well.
Java is the language more used in big corporate environments in the back end, that’s the reason. I don’t think it’s a surprise for any developer.
I also would like to see Go more in the communication environment, there is a WebRTC server developed by a former googler in GitHub but very basic, just supporting the Data Channel, and a couple of SIP libraries but I didn’t find anything more.
We are using PHP + JS for our web-based call center solution combined with Freeswitch and coturn for STUN/TURN server.
Georgi, thanks for sharing.
Can you please elaborate how has this combination been working for you?
https://goo.gl/6IHlPZ This also happens to be on the same lines. Although thank you for sharing the information, it was much help.
Hi,
I am new to this webRTC and have few basic question which i am struggling to understand. I would really appreciate if you help me understand these.
1. webRTC/Kurenot/OpenVidu, all of these provides the framework with webRTC functionalities. But none provide the Signaling server and it has to be developed separately, is that right?
2. In my understanding, the Application developed (web/mobile app) based on webRTC, will have client side (developed mostly in Java) and then the WebRTC FW, which will provide the RTP Stack. Then these clients will talk to the signaling server which is somewhere in the cloud to contact the other peer. Once this is through, then the clients can communicate directly (peer-peer) using the RTP.
Now the question is, Kurento talks about the Kurento Media Server (KMS) and the media flows through it to the other peer. Why ?
3. Can we develop the peer to peer communication without the media server in between ?
4. Does OpenVidu provides the Signaling Server ?
Thanks,
Santosh
1. Yes. In a way… to operate, such media servers have a demo/reference application or even a full fledged client. To run, they need signaling which is offered then by the media server framework itself. In most cases, my suggestion would be not to use that for a serious application as it lacks a lot of the logic you are going to need which is outside the scope of the video call itself.
2. Through the server, for the simple reason that a Kurento Media Server was developed to act like a media server…
3. Yes, but don’t expect it to offer good experience for a group video call.
4. Yes, as far as I know.