Key concepts of XMPP

Source: Internet
Author: User

Turn

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 XML Stanza to the client based on the information sent by the client and the program logic. 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.

XML section
The XML section is sent through an XML Stream. XMPP defines three top-level XML sections.

<Iq/>
<Message/>
<Presence/>

XMPP defines these three sectionsFive common attributes
To
From
Id
Type
Xml: lang

The to attribute specifies the JID of the Receiving Section.
The from attribute specifies the JID of the sender.
The id attribute is optional.In addition, it is unique in receiving applications (usually a server. Note: The Stream ID may be strictly secure, and must be neither predictable nor repeated.

The type attribute specifies the destination or message context, attendance or IQ section details.
The type attributes of iq include: Error, Get, Result, Set;
The type attributes of the presence Section include: Available, Subscribe, Subscribed, Unsubscribe, Unsubscribed, Unavailable, Probe, Error, Invisible;
The type attributes of message section include Chat, Error, GroupChat, Headline, and Normal.

Xml: lang attribute value specifies the default language for any readable XML character data

The <message/> section defines the message semantics. The <message/> section can be considered as a "push" mechanism. An entity pushes information to other entities, which is similar to communication in the EMAIL system. All message sections should have the 'to' attribute to specify the intended message receiver. Based on the received section, the server should route or transmit it to the intended receiver.
Message is used for transmission of "forgot after sending" (after sending, it does not verify whether the message is successfully received). Such transmission mainly applies to human-readable text, warnings, notifications, and other information.

The <presence/> section defines the attendance semantics. The <presence/> section can be considered as a basic broadcast or "publishing-subscription" mechanism. multiple entities receive their subscribed messages (in this case, information of an object. In general, the publishing entity should send an attendance section without the 'to' attribute. In this case, the server connected to this entity should broadcast to all subscribed entities. However, a publishing entity may also send an attendance section with the 'to' attribute. In this case, the server should route or transmit the section to the intended recipient.
Presence is used to broadcast network availability to those subscribed entities.

The <iq/> section defines the request semantics. The <iq/> section can be considered as a request-response mechanism, similar to [HTTP] in some aspects. IQ semantics makes it possible for an entity to request other entities or receive responses from other entities. The data content of the request and response is defined by the namespace declaration of the directly sub-element of IQ, and the interaction is tracked by the Request Entity by using the 'id' attribute. Therefore, IQ interactions follow a common pattern of structured data exchange, such as obtaining/result or setting/result (although if appropriate, the response to a request may be returned with an error ).
Iq section is used for reliable transmission-structured communication data control, error inclusion, configuration, and similar information (which is usually unreadable by humans ).

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.