http://wangruwei.blog.51cto.com/186868/47633
XMPP: Extensible Messaging and Presence Protocol Detail: [url]http://www.xmpp.org/[/url]可擴充消息處理現場協定, 是基于可擴充标記語言(XML)的協定,它用于即時消息(IM)以及線上現場探測。它在促進伺服器之間的準即時操作。這個協定可能最終允許網際網路使用者向網際網路上的其他任何人發送即時消息,即使其作業系統和浏覽器不同。 XMPP是一個流化XML[XML]元素的協定,用于準實時的交換消息和出席資訊。XMPP的核心功能定義在Extensible Messaging and Presence Protocol (XMPP): Core XMPP-CORE. 這些功能 -- 主要是 XML流, 使用 TLS和SASL,以及流的根元素之下的<message/>, <presence/>, 和 <iq/> 子元素 -- 為各種類型的準實時應用提供了一個構造基礎, 它可以被放在核心的頂層,使用特定XML名字空間[XML-NAMES]發送特定的應用資料. 我很想描述XMPP核心功能的擴充和應用,時間關系及了解的不是很透徹,也不敢亂發言;XMPP核心功能提供了RFC 2779 [IMP-REQS]定義的基本的即時消息和出席資訊功能。 比較好的開源代碼有:mobber和Jabber,一個代碼簡單易懂,另外一個功能比較全;本人比較喜歡的網站是: [url]http://www.jabber.org/[/url],裡面有好多基于各種系統的源代碼,隻要願意借鑒,隻管拿來就可以啦。 以下是本人在借鑒mobber和Jabber源代碼的基礎上開發的手機Jabber用戶端部分界面: 1、登入界面

2、好友清單
3、設定好友界面
為了更好的了解XMPP協定,附上XMPP協定說明,可以在此基礎上開發更多的用戶端。 【附】XMPP協定說明
基本的jabber用戶端必須實作以下标準協定(XEP-0211)
1、RFC3920 Core [url]http://tools.ietf.org/html/rfc3920 [/url]
2、RFC3921 Instant Messaging and Presence [url]http://tools.ietf.org/html/rfc3921 [/url]
3、XEP-030 Service Discovery [url]http://www.xmpp.org/extensions/xep-0030.html[/url]
4、XEP-0115 Entity Capabilities [url]http://www.xmpp.org/extensions/xep-0115.html[/url]
基本的jabber伺服器必須實作以下标準協定(XEP-0212)
1、RFC3920 Core [url]http://tools.ietf.org/html/rfc3920 [/url]
2、RFC3921 Instant Messaging and Presence [url]http://tools.ietf.org/html/rfc3921 [/url]
3、XEP-030 Service Discovery [url]http://www.xmpp.org/extensions/xep-0030.html[/url]
一、注冊
XEP-0077 In-Band Registration [url]http://www.xmpp.org/extensions/xep-0077.html[/url]
二、登入
XEP-0020 Software Version [url]http://www.xmpp.org/extensions/xep-0092.html [/url]
三、好友清單
XEP-0083 Nested Roster Groups [url]http://www.xmpp.org/extensions/xep-0083.html[/url]
1、擷取好友清單
2、存儲好友清單
XEP-0049 Private XML Storage [url]http://www.xmpp.org/extensions/xep-0049.html[/url]
3、備注好友資訊
XEP-0145 Annotations [url]http://www.xmpp.org/extensions/xep-0145.html[/url]
4、存儲書簽
XEP-0048 Bookmark Storage [url]http://www.xmpp.org/extensions/xep-0048.html[/url]
5、好友頭像
XEP-0008 IQ-Based Avatars [url]http://www.xmpp.org/extensions/xep-0008.html[/url]
XEP-0084 User Avatar [url]http://www.xmpp.org/extensions/xep-0084.html[/url]
XEP-0054 vcard-temp [url]http://www.xmpp.org/extensions/xep-0054.html[/url]
四、使用者狀态
RFC-3921 Subscription States [url]http://www.ietf.org/rfc/rfc3921.txt[/url]
五、文本消息
1、線上消息
2、離線消息
XEP-0013 Flexible Offline Message Retrieval [url]http://www.xmpp.org/extensions/xep-0013.html[/url]
XEP-0160 Best Practices for Handling Offline Messages [url]http://www.xmpp.org/extensions/xep-0160.html[/url]
XEP-0203 Delayed Delivery [url]http://www.xmpp.org/extensions/xep-0203.html[/url]
3、聊天狀态通知
XEP-0085 Chat State Notifications [url]http://www.xmpp.org/extensions/xep-0085.html[/url]
六、群組聊天
1、XEP-0045 Multi-User Chat [url]http://www.xmpp.org/extensions/xep-0045.html[/url]
七、檔案傳輸
1、XEP-0095 Stream Initiation [url]http://www.xmpp.org/extensions/xep-0095.html[/url]
2、XEP-0096 File Transfer [url]http://www.xmpp.org/extensions/xep-0096.html[/url]
3、XEP-0065 SOCKS5 Bytestreams [url]http://www.xmpp.org/extensions/xep-0065.html[/url]
4、XEP-0215 STUN Server Discovery for Jingle [url]http://www.xmpp.org/extensions/xep-0215.html[/url]
5、RFC-3489 STUN [url]http://tools.ietf.org/html/rfc3489[/url]
八、音視訊會議
1、XEP-0166 Jingle [url]http://www.xmpp.org/extensions/xep-0166.html#negotiation[/url]
2、XEP-0167 Jingle Audio via RTP [url]http://www.xmpp.org/extensions/xep-0167.html[/url]
3、XEP-0176 Jingle ICE Transport [url]http://www.xmpp.org/extensions/xep-0176.html[/url]
4、XEP-0180 Jingle Video via RTP [url]http://www.xmpp.org/extensions/xep-0180.html#negotiation[/url]
5、XEP-0215 STUN Server Discovery for Jingle [url]http://www.xmpp.org/extensions/xep-0215.html[/url]
6、RFC-3489 STUN [url]http://tools.ietf.org/html/rfc3489[/url]
九、使用者查詢
XEP-0055 Jabber Search [url]http://www.xmpp.org/extensions/xep-0055.html[/url]
整體:
一、協定資料互動
XEP-0004 Data Forms [url]http://www.xmpp.org/extensions/xep-0004.html[/url]
二、jabber-RPC
XEP-0009 Jabber-RPC [url]http://www.xmpp.org/extensions/xep-0009.html[/url]
三、功能協商
XEP-0020 Feature Negotiation [url]http://www.xmpp.org/extensions/xep-0020.html[/url]
四、服務發現
XEP-0030 Service Discovery [url]http://www.xmpp.org/extensions/xep-0030.html[/url]
五、會話建立
XEP-0116 Encrypted Session Negotiation [url]http://www.xmpp.org/extensions/xep-0116.html[/url]
XEP-0155 Stanza Session Negotiation [url]http://www.xmpp.org/extensions/xep-0155.html[/url]
XEP-0201 Best Practices for Message Threads [url]http://www.xmpp.org/extensions/xep-0201.html[/url]