What is janus?

As described by its creator meetecho, janus is a general purpose WebRTC endpoint that browsers can interact with, and its' different modules can determine what should be done with the media. You can do, text messaging, video conferencing, streaming and more other things with janus. Also if there is no such module to do functionalities that you are looking for, you can expand janus by yourself.

Why do we want janus?

For basic peer to peer WebRTC communications, we established peer connection directly through the browser. But when we want to expand to multi-user platform like a video conference or a chat room, we want a media server to scale the system. Here janus plays that media server role.

Janus architecture and APIs

There are some main sections in janus architecture.

  • Core - core of the server specified here.
  • Plugin - plugins will help you to implement functionalities like, video streaming, video conferencing, etc. Also you can create your own plugin by Plugin API.
  • JavaScript API - this will help you to integrate with plugins that are provided by the janus server.

There are few other APIs in janus, but these are the main and useful APIs when we are working with janus. You can refer others here.

How to use janus in your application

The file janus.js will help us to communicate with janus media server and work with the plugins that janus already provided. First you need to make a Janus object in your application and attach one of the plugin to it as shown below.

Janus.init({debug: "all", callback: function() {
      // Make sure the browser supports WebRTC
      // Create session
        janusRoom = new Janus(
          {
              server: JANUS_SERVER_URL,
              iceServers: ICE_SERVERS,
    
              success: function() {
                  // Attach to VideoRoom plugin
                  janusRoom.attach(
                      {
                          plugin: "janus.plugin.echotest",

After that you will return pluginHandler object with many commands and event handlers. Then you can use that handler to implement your specific feature. You can refer to those commands and events in janus.js.