上一节,我们介绍了XMPP的基础,还没说完,说到了通信洪流,然后就结束了。这一节,我们接着讲。主要是“stanzas”(节).上一节,我们说,区分stanzas,需要从它的名字,属性TYPE和子节点来区分。这一节,我们分别介绍:消息(Message),出席/上线(Presence),信息查询(IQ)以及可扩展性(Extensibility)。
<message from="[email protected]/foo" to="[email protected]" type="chat"> <body>Who are you?</body> <subject>Query</subject> </message>
<presence from="[email protected]/pda"> <show>xa</show> <status>down the rabbit hole!</status> </presence>
<iq from="[email protected]/pda" id="rr82a1z7" to="[email protected]" type="get"> <query xmlns="jabber:iq:roster"/> </iq>回复:
<iq from="[email protected]" id="rr82a1z7" to="[email protected]/pda" type="result"> <query xmlns="jabber:iq:roster"> <item jid="[email protected]"/> <item jid="[email protected]"/> <item jid="[email protected]"/> <item jid="[email protected]"/> </query> </iq>
<iq from="[email protected]/pda" id="ru761vd7" to="[email protected]" type="set"> <query xmlns="jabber:iq:roster"> <item jid="[email protected]"/> </query> </iq>
<iq from="[email protected]" id="ru761vd7" to="[email protected]/pda" type="result"/>