At Control Group, we often need to create an interactive environment where different types of devices must communicate with each other and users. Sometimes this communication is initiated in a very obvious manner. For instance, if you click a button on a web page, a web server can receive this message and update a database, or turn on a camera, or lock a door, etc. However, sometimes this communication is more intricate. As an example, imagine you walk into a room where the lights automatically turn on and respond to your position, voice commands, and physical gestures. This interactivity can easily require a whole concert of digital devices working together seamlessly. When designing a system like this that supports numerous users, even more devices may be needed. How can this level of interactivity be achieved in a reliable, scalable, and elegant way?
There is no single tool that fits the bill. Instead there is a whole ecosystem of software, tools, and protocols to choose from. Fortunately many of these tools are becoming very mature and stable. The kind of work that Control Group does generally requires very good performance and high availability. This need translates into a communication strategy that includes messaging delivered via UDP and TCP/IP.
Communication over UDP is valuable for it’s small bandwidth footprint. It’s also ideal for supporting broadcast messages. Our favorite tool for this is Open Sound Control (OSC). Though OSC was designed originally for audio tools, it’s design is flexible enough for almost any messaging application. However UDP as a standard is not reliable enough for mission critical messages. For that we use TCP/IP messaging.
XMPP (jabber) is nearly perfect for communicating between devices over TCP/IP. The most solid open source server stack for XMPP is ejabberd. The ejabberd software is written in Erlang and is designed for lightweight performance and durability. It is easy to manage, takes little time to integrate, and scales very well horizontally. As far as client stack is concerned, it will depend upon the platforms you must support. We choose gloox for Windows, OSX, and linux and XmppFramework for iOS integration. However, there are plenty of alternatives if you need support for something else. Visit xmpp.org to see a list of available client libraries.