O'Reilly logo

XMPP: The Definitive Guide by Remko Tronçon, Kevin Smith, Peter Saint-Andre

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Sending Binary Data

So far, we have mainly considered the exchange of small pieces of structured information: sending and receiving of messages (with or without markup, to one or more parties), broadcasting information about various forms of presence, sending alerts using PubSub, and the like. In Chapter 9, we delved into the Jingle framework for session negotiation, but we focused on the structured signaling messages rather than binary media data such as voice and video chats. In this chapter, we look at sending other kinds of binary data, especially files. We’ll proceed in ascending order from small pieces of binary data up to large files.

Starting Small: Bits of Binary

As we have noted, XMPP is not optimized for sending binary data. But sometimes the data you want to send is so small and seemingly insignificant that you figure there must be a way to send it in-band. Why should those XML zealots prevent you from sharing, say, a small image file? Such images can be quite useful when you want to send an emoticon (those “smiley” and “frowny” faces that kids of all ages exchange over IM systems), a CAPTCHA (“Completely Automated Public Turing Test to Tell Computers and Humans Apart”) to prevent malicious bots from overwhelming your XMPP server with new account registrations, and so on.

The XMPP developer community lacked such a method for a long time, so in 2008 they finally defined one, called Bits of Binary XEP-0231, or BOB for short. The approach is simple: include a unique ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required