XMPP protocol and practice, XMPP protocol practice

Source: Internet
Author: User

XMPP protocol and practice, XMPP protocol practice

I. XMPP protocol

XMPP(Extensible Messaging and Presence Protocol scalable Message Processing site Protocol) isProtocols Based on Extensible Markup Language (XML)It is used for instant messaging (IM) and online on-site detection. The predecessor of XMPP is Jabber. XMPP-based applications have high scalability.

1. Several important concepts in XMPP:

JID: Jabber ID. An xmpp network has one or more address jids, such as a@aaa.lit/study.

Composition: nodes, domains, and resources (the jid with resources is the complete jid, And the jid without resources is the bare jid). nodes and resources are optional, and fields are required. Jid ResourcesIdentifies a specific client.Xmpp links. For xmpp clients, each link is assigned a resource.


XMPP defines three roles,Clients, servers, and gateways.
Communication can take place between any two of the three.
ServerIt also undertakes the client information record, connection management and information routing functions.
GatewayIt is interconnected with heterogeneous instant messaging systems. heterogeneous systems can include SMS, MSN, and ICQ.


All the XML texts sent by the client or server are joined together, from <stream> to </stream> to form a complete XML document.
XML Stream: The stream tag is the so-called XML Stream.
XML section: The XML elements such as <message>... </message> in the center of <stream> and </stream> are the so-called XML Stanza.


For details about the XMPP protocol, I only wrote a rough description here. For more information, see the "XMPP protocol reference manual" or read related books.


2. How XMPP works:

(1) first create a stream, and then negotiate a bunch of security and other things. The intermediate communication process is to send XML Stanza to the server one by one from the client.

(2) the server sends XML Stanza to the client based on the information sent by the client and the program logic. (This process is not an answer. At any time, it is possible to send a letter from one party to the other .)

(3) Close the stream at the final stage of communication </stream> and disable the TCP/IP connection.

XMPP is a data transmission protocol that is very similar to the http protocol. Its process is like the process of "unpackaging --> packaging". You only need to understand the type it receives, and understand the type it returns, so that xmpp can be used for data communication.


Ii. XMPP Environment

1. Server Software

Server Software List: http://xmpp.org/xmpp-software/servers/

The most commonly used is Openfire. Ejabberd is also used in many cases.

For how to install and configure Openfire, see the following blog.

Http://blog.csdn.net/shimiso/article/details/8816558 Windows

Mac http://blog.csdn.net/jeepxiaozi/article/details/16357337


2. Client Software

Client software is mainly used for self-development and testing.

Client Software List: http://xmpp.org/xmpp-software/clients/

Client usageSparkWhen you log on, create several more accounts on the server, and then directly log on to one of the accounts. Then, add a contact to chat.

For other client software, refer to Spark (the most important thing is to enter the JID correctly)

Refer to the following article: (for reference only, not as complicated as he wrote. Step 4 is another thing. You don't have to worry about it)

Http://www.cnblogs.com/top5/archive/2009/04/07/1431001.html


Iii. XMPP practices

1. Develop IM software with XMPP on iOS

Connect your own client to the XMPP server to implement basic chat functions.

Not complete ....


2. Develop IM software with XMPP on Android

Connect your own client to the XMPP server, similar to iOS. Android has more materials and source code than iOS.

Not complete ....


Refer:

RFC3920_XMPP Chinese translation specification (Baidu Library)

4 XMPP Android series in http://blog.csdn.net/shimiso/article/details/8816558

Http://code4app.com/ios/xmpp-for-ios/521705756803fa7c32000006

Http://www.cnblogs.com/PhenixWang/p/3275454.html XMPP iOS

Http://blog.csdn.net/kangx6/article/details/7739828 4 XMPP iOS Series

Https://github.com/robbiehanson/XMPPFramework/wiki/GettingStarted_iOS XMPPFramework

Http://code4app.com/search/XMPP source code


Reprinted please indicate the source: http://blog.csdn.net/xn4545945




What is the principle of XMPP?

XMPP is an XML-based protocol that inherits the flexible development in the XML environment. Therefore, XMPP-based applications are highly scalable. After the extension, XMPP can send extended information to meet user requirements, and create application processes such as the content publishing system and address-based services at the top of XMPP. In addition, XMPP includes a software protocol for the server to enable communication with the other, making it easier for developers to build customer applications or add functions to a system.
-------------------------------------- Baidu encyclopedia... Sorry, I don't know exactly what kind of information is: baike.baidu.com/view/2718513.htm.

How to Learn xmpp protocol

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.