Saturday, December 7, 2013

What is XMPP and why using it

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.

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

Raspiberry Pi

The Raspberry pi is a mini computer which is designed in a single board with all the essential components required for running an operating system. The Raspberry pi is designed to be low cost and easy to use. The board has a micro USB port which can be used to supply 5V DC using an adaptor with rating not less than 1A. The board can be powered up from the USB port also but it is not recommended. The board has a HDMI port which can be used to connect it to the HD TV using an HDMI cable. A video input port is also available with a Raspberry pi board which can be used to connect an external camera. The board can also be connected to the PC monitor using a HDMI to VGA adaptor cable. The Raspberry pi board has a Composite RCA (PAL and NTSC) output which enables them to be connected directly to CRT TV screens and an audio output is also available. The board has two USB2 ports where the keyboard and mouse can be plugged in. There is an Ethernet port which can be used to connect the board to a computer network. The board also has a SD card slot and the Raspberry pi is designed to boot from the SD card.
The device using Broadcom controller chip which is an SoC (System on Chip). This controller has all the peripherals like timers, interrupt controller, GPIO, USB, PCM / I2S, DMA controller, I2C master, I2C / SPI slave, SPI0, SPI1, SPI2, PWM, UART0 and UART1. This SoC has the powerful ARM11 processor which runs on 700 MHz at its core. The controller also has a graphical processing unit (GPU) which includes VideoCore, MPEG-2 and MPEG-4. It also has a 512 MB SDRAM.    
The operating systems versions of Windows, Mac and Linux are available which can be installed in the Raspberry pi board. Raspberry Pi foundation introduced a new tool called "New Out Of Box Software" or "NOOBS" which includes a package of Operating systems which the user can select to install on the Raspberry pi board once it boots up for the first time. The operating systems the NOOBS installer includes are only Archlinux ARM, OpenELEC, Pidora, Raspbmc, RISC OS and the Raspbian. This article discusses how to install the Ubuntu operating system in the Raspberry pi.