|--------------------| | <stream> | |--------------------| | <presence> | | <show/> | | </presence> | |--------------------| | <message to=‘foo‘> | | <body/> | | </message> | |--------------------| | <iq to=‘bar‘> | | <query/> | | </iq> | |--------------------| | ... | |--------------------| | </stream> | |--------------------|
| 初始化方发给接收方 | 接收方发给初始化方 | |
|---|---|---|
| to | 接收方的主机名 | 忽略 |
| from | 忽略 | 接收方的主机名 |
| id | 忽略 | 会话键值 |
| xml:lang | 缺省语言 | 缺省语言 |
| version | 支持XMPP 1.0 | 支持XMPP 1.0 |
{image:img=iq}
请求实体 响应实体
---------- ----------
| |
| <iq type=‘get‘ id=‘1‘> |
| ------------------------> |
| |
| <iq type=‘result‘ id=‘1‘> |
| <------------------------ |
| |
| <iq type=‘set‘ id=‘2‘> |
| ------------------------> |
| |
| <iq type=‘error‘ id=‘2‘> |
| <------------------------ |
| |
<stream:error> <defined-condition xmlns=‘urn:ietf:params:xml:ns:xmpp-streams‘/> <text xmlns=‘urn:ietf:params:xml:ns:xmpp-streams‘ xml:lang=‘langcode‘> OPTIONAL descriptive text </text> [OPTIONAL application-specific condition element] </stream:error>
<stream:error> <xml-not-well-formed xmlns=‘urn:ietf:params:xml:ns:xmpp-streams‘/> <text xml:lang=‘en‘ xmlns=‘urn:ietf:params:xml:ns:xmpp-streams‘> Some special application diagnostic information! </text> <escape-your-data xmlns=‘application-ns‘/> </stream:error> </stream:stream>
C: <?xml version=‘1.0‘?> <stream:stream to=‘example.com‘ xmlns=‘jabber:client‘ xmlns:stream=‘http://etherx.jabber.org/streams‘ version=‘1.0‘> S: <?xml version=‘1.0‘?> <stream:stream from=‘example.com‘ id=‘someid‘ xmlns=‘jabber:client‘ xmlns:stream=‘http://etherx.jabber.org/streams‘ version=‘1.0‘> ... encryption, authentication, and resource binding ... C: <message from=‘juliet@example.com‘ to=‘romeo@example.net‘ xml:lang=‘en‘> C: <body>Art thou not Romeo, and a Montague?</body> C: </message> S: <message from=‘romeo@example.net‘ to=‘juliet@example.com‘ xml:lang=‘en‘> S: <body>Neither, fair saint, if either thee dislike.</body> S: </message> C: </stream:stream> S: </stream:stream>
C: <?xml version=‘1.0‘?> <stream:stream to=‘example.com‘ xmlns=‘jabber:client‘ xmlns:stream=‘http://etherx.jabber.org/streams‘ version=‘1.0‘> S: <?xml version=‘1.0‘?> <stream:stream from=‘example.com‘ id=‘someid‘ xmlns=‘jabber:client‘ xmlns:stream=‘http://etherx.jabber.org/streams‘ version=‘1.0‘> ... encryption, authentication, and resource binding ... C: <message xml:lang=‘en‘> <body>Bad XML, no closing body tag! </message> S: <stream:error> <xml-not-well-formed xmlns=‘urn:ietf:params:xml:ns:xmpp-streams‘/> </stream:error> S: </stream:stream>
原文:http://www.cnblogs.com/hujihon/p/3734681.html