Xmpp rfc Reading Notes (1)

Source: Internet
Author: User
Tags abstract definition rfc
All of the following content is based on your own memory and understanding. If there are any errors or errors, please forgive me.

1. What is XMPP?

The predecessor of XMPP is jabber, an open-source network instant communication protocol. XMPP has been standardized by IETF International Standards Organization. The core results of standardization are divided into two parts;

Core XML Stream Transmission Protocol

Instant Messaging extension application based on XML Stream Transmission

The core XML Stream Transmission Protocol of XMPP enables XMPP to be deployed on a platform that is more standard than previous network communication protocols. With the help of XML's easy-to-parse and read features, the XMPP protocol can be very beautiful.

The XMPP instant messaging extension application is based on an abstract definition of instant messaging by IETF prior to this, and is widely used with other instant messaging protocols, such as aim, QQ and other advanced features are complete and improved.

2. What is the basic network structure of XMPP?

XMPP defines three roles: client, server, and gateway. Communication can take place between any two of the three. The server also undertakes the client information record, connection management and information routing functions. Gateways are interconnected with heterogeneous instant messaging systems. heterogeneous systems can include SMS, MSN, and ICQ. The basic network mode is that a single client connects to a single server through TCP/IP, and then transmits XML on it.

3. What does XMPP pass over TCP?

Commands related to instant messaging are transmitted. In the past, these commands were either sent in a binary format (for example, QQ), or sent in a text-only command with a space and a parameter with a line break (for example, MSN ). The logic of the instant messaging commands transmitted by XMPP is similar to that in the past, but the Protocol format is changed to plain text in XML format. This not only makes parsing easier, but also makes reading easier, facilitating development and troubleshooting. The core part of XMPP is a stream protocol that sends XML data in parts on the network. This stream protocol is the basis for transmitting XMPP instant messaging commands, and is also a very important basic network protocol that can be further used. Therefore, XMPP uses TCP to transmit XML streams.

4. Let's take an example to see what the so-called XML Stream looks like?

Client: <? XML version = '1. 0'?>

<Stream: Stream

To = 'example. com'

Xmlns = 'jabber: client'

Xmlns: stream = 'HTTP: // etherx.jabber.org/streams'

Version = '1. 0'>

Server: <? XML version = '1. 0'?>

<Stream: Stream

From = 'example. com'

Id = 'someid'

Xmlns = 'jabber: client'

Xmlns: stream = 'HTTP: // etherx.jabber.org/streams'

Version = '1. 0'>

... Other communications...

Client: <message from = 'juliet @ example.com'

To = 'Romeo @ example.net'

XML: lang = 'en'>

Client: <body> art thou not Romeo, and a Montgomery? </Body>

Client: </message>

Server: <message from = 'Romeo @ example.net'

To = 'juliet @ example.com'

XML: lang = 'en'>

Server: <body> neither, fair saint, if either thee dislike. </body>

Server: </message>

Client: </stream: stream>

Server: </stream: stream>

From the document's point of view, all the XML texts sent by the client or server are concatenated, from <stream> to </stream> to form a complete XML document. The stream tag is the so-called XML stream. XML elements such as <message>... </message> in the center of <stream> and </stream> are the so-called XML stanza (XML section ). The basic mode of XMPP core protocol communication is to first create a stream, and then negotiate a bunch of security and other things. The intermediate communication process is that the client sends XML stanza one by one. The server sends messages based on the client and Program To send XML stanza to the client. However, this process is not a question and answer. At any time, it is possible to send a letter from one party to another. The final phase of communication is </stream> closing the stream and closing the TCP/IP connection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.