11.1. Inbound Stanzas 1.4.1:
For message stanzas, the server SHOULD deliver the stanza to the highest-priority available resource (if the resource did not provide a value for the <priority/> element, the server SHOULD consider it to have provided a value of zero). If two or more available resources have the same priority, the server MAY use some other rule (eg, most recent connect time, most recent activity time, or highest availability as determined by some hierarchy of <show/> values) to choose between them or MAY deliver the message to all such resources. However, the server MUST NOT deliver the stanza to an available resource with a negative priority; if the only available resource has a negative priority, the server SHOULD handle the message as if there were no available resources (defined below). In addition, the server MUST NOT rewrite the 'to' attribute (ie, it MUST leave it as <user@domain> rather than change it to <user@domain/resource>).
4.1. Specifying an Intended Recipient
An instant messaging client SHOULD specify an intended recipient for a message by providing the JID of an entity other than the sender in the 'to' attribute of the <message/> stanza. If the message is being sent in reply to a message previously received from an address of the form <user@domain/resource> (eg, within the context of a chat session), the value of the 'to' address SHOULD be of the form <user@domain/resource> rather than of the form <user@domain> unless the sender has knowledge (via presence) that the intended recipient's resource is no longer available. If the message is being sent outside the context of any existing chat session or received message, the value of the 'to' address SHOULD be of the form <user@domain> rather than of the form <user@domain/resource>.
< message type = 'chat' from ='client@example.com/resource1 ' to ='client1@example.com' id = 'uid12' >
< body > message with resource1 </ body >
< thread > uid11 </ thread >
< x xmlns = 'jabber: x: event' >
< offline />
< delivered />
< displayed />
< composing />
</ x >
< active xmlns = 'http: //jabber.org/protocol/chatstates' />
</ message >
< message type = 'chat' from ='client@example.com/resource2 ' to ='client1@example.com' id = 'uid6' >
< body > message from resource2 </ body >
< thread > uid5 </ thread >
< x xmlns = 'jabber: x: event' >
< offline />
< delivered />
< displayed />
< composing />
</ x >
< active xmlns = 'http: //jabber.org/protocol/chatstates' />
</ message >
< message from ='client1@example.com/Miranda ' to ='client@example.com' xml: lang = 'en' type = 'chat' id = 'mir_12' >
< body > answer from miranda </ body >
</ message >
Source: https://habr.com/ru/post/38665/
All Articles