Xmpp Mini Manual

Páginas: 13 (3082 palabras) Publicado: 24 de enero de 2013
Developers  |  How To

______________________________________________________________________________________________

Use XMPP to Create Your Own Google Talk Client
Instant communication is now the essence of social networking and the Internet. The popular Google Talk, which uses XMPP (Extensible Messaging and Presence Protocol), made this Instant Messaging protocol prominent among openstandards protocols. Exploring XMPP (formerly known as the Jabber protocol) is fun—it is a transparent and simple architecture. Once you understand it, you can easily write your own XMPP/GTalk clients from the ground up, using the friendly and powerful Python scripting language.

X

MPP is an XML-based open standards protocol. It uses XML streams to implement the entire message communicationsystem. XMPP is used in a de-centralised clientserver architecture, in which a server acts as an intermediary for the message transfer, and also manages services like the user account registration, authentication, buddy list database, etc. Since our primary focus is on clients, we won't dig any more into the server part—we will just consider the server to be a ‘black box’ entity available at aspecific IP address/ hostname and port number, which meaningfully responds to our XMPP requests. We connect to the server using a TCP socket in our program. An explanation of networking, TCP/IP, IP addresses, ports and sockets is too much information to put into this article, so if these concepts are new to you, you could visit http://en.wikipedia.org/wiki/Internet_socket for
32  |  MAY 2010 | LINUX ForYoU | www.LinuxForU.com

some quick reading. Since our purpose in this article is to code our own Google Talk client, the hostname of the server we will use is gmail.com, and the port we will use is 5222, the default port for the XMPP service. The sequence of the initial interaction between client and server is as follows: 1. The client connects to the server and sends credentials like theusername and password. 2. The server validates the received credentials against its user database and sends a response to the client. 3. When authentication is successful, the client receives a response containing presence notification data. This is a collection of presence data from different buddies of the user, which the client authenticated to the server. Presence is explained below. As alreadynoted, the communication between client and server is in the form of

_____________________________________________________________________________________________________

How To 

|  Developers

XML streams, over the connection created at the beginning of the interaction. Before we get down to the code, we need to define some terms and underlying concepts that are involved with the use ofthe XMPP protocol. To write an XMPP client, we don't need a thorough understanding of the XML streams that are exchanged between client and server, since we use libraries that abstract away the complexities of the underlying protocol, and provide an API to us. In this article, we'll be using Python to write our code, and the python-xmpp library provides us a neat API. We need to understand thetypes of communication and interaction involved, however, so let's begin. Note: The XML streams shown below as examples are not as they would actually be in a live XMPP session, since I have omitted attributes of some elements, and omitted portions of the XML stream that are not required to illustrate the concept. Since the python-xmpp library handles the nitty-gritty of building, sending, andreceiving the XML streams, you don't need to memorise the XML samples—just look at them as illustrations, and not as code that you have to write yourself.

Presence

As the word signifies, presence is a method by which a client/user notifies buddies and the XMPP server of its current status—whether the user is online or offline. When a client authenticates, it sends a presence notification stanza...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Mini Manual De Corel X3
  • Manual de mantenimiento de mini split
  • Mini Manual De Practicas
  • manual mini vtec
  • mini manual de cad
  • mini manual de cad
  • Mini Manual Surfer
  • mini manual autocad

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS