are learning XMPP reprint

Source: Internet
Author: User
Tags abstract definition
1, what is XMPP.
The predecessor of XMPP was Jabber, an open-source form of network Instant Messaging protocol generated by the Organization. XMPP is currently being standardized by IETF International standards Organization. The core results of standardization are divided into two parts;
Core XML Stream Transfer Protocol
Extended application of instant communication based on XML stream transmission
The definition of XMPP's core XML Stream Transfer Protocol enables XMPP to be on a more standardized platform than the previous network communication protocol. The XMPP protocol can be very beautiful with the help of XML's easy parsing and reading features.
XMPP's Instant Messaging extension application is partly based on an abstract definition of instant messaging by the IETF prior to this, with features such as full-featured, refinement, etc. that have been widely used in instant messaging protocols such as AIM,QQ.

2, the basic network structure of XMPP is how.
The XMPP defines three roles, clients, servers, gateways. Communication can take place between any two of these three. The server simultaneously undertakes the client information record, the connection management and the information routing function. The gateway undertakes the interconnection with the heterogeneous instant communication system, the heterogeneous system may include the SMS (SMS), the MSN,ICQ and so on. The basic network form is that a single client connects to a single-server through TCP/IP and then transmits XML on top.

3, XMPP pass TCP what.
The transmission is the instructions associated with Instant messaging. In the past, these commands are either sent in the form of 2 (such as QQ), or with a plain text instruction plus a space plus the parameters of the line Fu to send (such as MSN). The logic of the XMPP transmission is similar to that of the past, but the form of the protocol becomes plain text in XML format. This not only makes parsing easy, people also easy to read, convenient development and error checking. The core part of XMPP is a stream protocol that sends XML over the network fragment. This flow protocol is the basis of XMPP's instant messaging instruction and is also a very important network infrastructure protocol that can be further exploited. So it can be said that XMPP with TCP is the XML stream.

4, for example, 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 montague?</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 a document standpoint, all XML text sent by the client or server is consonant together, and a complete XML document is formed from <stream> to </stream>. The stream label is the so-called XML stream. XML elements such as <message>...</message> in <stream> and </stream> are called XML Stanza (XML sections). The basic mode of XMPP core protocol communication is to establish a stream first, and then negotiate a heap of security and other things, the intermediate communication process is the client sent XML Stanza, one after another. The server sends the XML stanza to the client based on the information sent by the client and the logic of the program. But the process is not an answer, and at any time it is possible to send a letter from one side to the other. The final stage of communication is </stream> shutdown the stream, shutting down the TCP/IP connection.

An entity can be any network endpoint (such as an ID on a network) and can communicate with XMPP. All entities of this category can be uniquely addressed and conform to [RFC 2396 [URI]] style. For historical reasons, the address of a XMPP entity is called a jabber identifier or Jid. A valid Jid consists of three parts: a domain identifier , a node identifier , and a resource identifier

The Jid syntax is defined using the [ABNF] expression. (Definitions of the IPV4 address and IPV6 address are defined in Appendix B [IPV6]

Jid = [node ' @ '] domain ['/' resource]

Domain = fqdn/address-literal

FQDN = (sub-domain 1* ("." Sub-domain))

sub-domain = (internationalized domain label)

Address-literal = ipv4address/ipv6address

All the Jid are based on the above structure. This structure is mostly used to identify a user of instant messaging communications, which connections on the server, and the user's connection resources in the form of <user@host/resource>. However, the type of node may not be a client; For example, a chat room provides a multi-user chat service, its address can be <room@service> ("Room" is the name of the chat room, "service" is the host name to provide multi-user Chat service). Or a user in a chat room is addressed as <room@service/nick> ("Mick" is the nickname of the user in the chat room). It is possible to have multiple other Jid types (such as <domain/resource> can be a server-side script or service).

Each part of a jid (field identifier, node identifier, and resource identifier) cannot be longer than the 1023 Byte, thus the total number of bytes (including "@" and "/") cannot exceed 3071 bytes.

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.