What’s Your Preferred Language for WebRTC Development?

03/10/2016

WebRTC isn’t limited to JavaScript.

Your preferred language for WebRTC

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.

WebRTC entities

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?

WebRTC web applicationWeb 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.

WebRTC mobile applicationMobile 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.

WebRTC embedded applicationEmbedded 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:

  1. C, C++ if you port the webrtc.org code base and use it. And then whatever else you fancy on top of it
  2. 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).

WebRTC TURN/STUN serverTURN 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.

WebRTC media serverMedia 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.

WebRTC signaling serverApp/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.

Responses

Luis Lopez says:
October 3, 2016

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.

Reply
    Tsahi Levent-Levi says:
    October 3, 2016

    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.

    Reply
Gustavo Garcia says:
October 3, 2016

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…)

Reply
    Tsahi Levent-Levi says:
    October 4, 2016

    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.

    Reply
Antón says:
October 14, 2016

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.

Reply
Georgi says:
October 21, 2016

We are using PHP + JS for our web-based call center solution combined with Freeswitch and coturn for STUN/TURN server.

Reply
Rasin Bekkevold says:
October 24, 2016

https://goo.gl/6IHlPZ This also happens to be on the same lines. Although thank you for sharing the information, it was much help.

Reply

Comment