What is XMPP
Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML (Extensible Markup Language). The protocol was originally named Jabber, and was developed by the Jabber open-source community in 1999 for near real-time, instant messaging (IM), presence information, and contact list maintenance.
What is the problem if we don't use XMPP
In most cases the Raspberry Pi does not have a public IP address. The Raspberry Pi can initiate a connection to web servers that have public IP addresses. But those servers can not initiate a connection to Raspberry Pi. That means servers can not send any information to Raspberry Pi until Raspberry Pi start the connection. So the latency of messages from servers can not be guaranteed.
In order to minimize that latency, our Raspberry Pi can either inquire the server periodically or keep the connection alive. The first option is not efficient and the second option is not supported in free web services such as App Engine.
Last updated on 2015-04-18 at 11.20.51 PM
Published on 2013-08-15 at 10.36.25 PM
How XMPP solve this problem
There are many free XMPP servers on Internet and those servers can keep a long-lived TCP connection with our Raspberry Pi. Since all XMPP servers have public IP address, they can exchange messages freely. This method can eliminate the unnecessary latency introduced by polling intervals.