If you are looking for Jitsi Meet, the WebRTC compatible video conferencing product click here.

previous | TOC | next

Implementing a Protocol

Getting started

This tutorial will walk you through the process of implementing support for an instant messaging protocol in Jitsi. In here we will be implementing Gibberish - a non existent protocol that doesn’t even require a network connection. The Gibberish protocol will allow us to add to our contact list as many contacts as we wish, treating all of them as if they really existed.

Once added to to our contact list, contacts will change status so that it matches our own Gibberish status, and when we write to them, they will echo our typing notifications and messages back to us.

In addition we’d also like to be able to register multiple Gibberish accounts in Jitsi and when added they would have to communicate with each other the way the would in the case of a real world protocol. In other words when we write to a Gibberish contact that has the same id as a Gibberish account that we have registered, we would like for it to receive our messages and typing notifications instead of simply echoing them back to us. The same goes for authorization requests, responses and typing notifications.

During the following chapters we are going to work on the implementation of this imaginary protocol. We’ll build all basic elements such as, the OSGi bundle itself, a bundle activator, a protocol provider factory and a protocol provider service implementation. We are then going to cover the implementation of some of the more common operation sets. (I’ll also try to keep adding chapters to this tutorial so that it will one day cover all possible aspects of a protocol implementation and contain sample implementations of every possible operation set).

In addition we’ll show you how to implement a SLICK (unit and compatibility tests) for the Gibberish protocol as well as a wizard that would allow Jitsi users to create Gibberish accounts.

The Gibberish example protocol implementation is available for download together with the Jitsi source code. The implementation is also available for review here

Before you start, make sure you have the latest version of the Jitsi source code and that you are able to build and run it successfully.

N.B.: Note that when implementing a real protocol one of the first things you should do is find and test a protocol stack. Before being able to implement inside Jitsi support for a specific protocol, you have to first make sure you have a suitable protocol stack. You’ll often have multiple options so make sure you chose the one that answers most of the following points:

  • Open Source license - wouldn’t be possible to integrate it inside Jitsi without it.
  • Examples and/or Documentation - shows that the project maintainers are making efforts to make their lib usable.
  • Project references - shows that other projects have also found this library worth using
  • Lively community - without which you’d have to do all the bug fixing all buy yourself (could be quite a difficult task)
  • Frequent release dates and a busy version control repository - shows that people are working on the project. Means that any bug fixes you contribute would probably be rapidly reviewed and adopted.
  • Ease of use - that’s rather personal but it’s very important nevertheless.

Once you’ve made your choice, it is generally a very good idea to spend a few days learning this stack and getting to know its functionalities (if you are still not sure you like it after the test period, don’t hesitate to try another one). Once you feel relatively confident that you know which stack you are using and you are pretty much aware what it is capable of, you may step to the task of adding it to the Jitsi.

previous | TOC | next