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 ...
Get XMPP: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.