1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# Basic message routing and delivery
[Client] Romeo
jid: user@localhost
password: password
[Client] Juliet
jid: juliet@localhost
password: password
[Client] Juliet's phone
jid: juliet@localhost
password: password
resource: mobile
---------
# Act 1, scene 1
# The clients connect
Romeo connects
Juliet connects
Juliet's phone connects
# Romeo publishes his presence. Juliet has not, and so does not receive presence.
Romeo sends:
<presence/>
Romeo receives:
<presence from="${Romeo's full JID}" />
# Romeo sends a message to Juliet's full JID
Romeo sends:
<message to="${Juliet's full JID}" type="chat">
<body>Hello Juliet!</body>
</message>
Juliet receives:
<message to="${Juliet's full JID}" from="${Romeo's full JID}" type="chat">
<body>Hello Juliet!</body>
</message>
# Romeo sends a message to Juliet's phone
Romeo sends:
<message to="${Juliet's phone's full JID}" type="chat">
<body>Hello Juliet, on your phone.</body>
</message>
Juliet's phone receives:
<message to="${Juliet's phone's full JID}" from="${Romeo's full JID}" type="chat">
<body>Hello Juliet, on your phone.</body>
</message>
# Scene 2
# This requires the server to support offline messages (which is optional).
# Romeo sends a message to Juliet's bare JID. This is not immediately delivered, as she
# has not published presence on either of her resources.
Romeo sends:
<message to="juliet@localhost" type="chat">
<body>Hello Juliet, are you there?</body>
</message>
# Juliet sends presence on her phone, and should receive the message there
Juliet's phone sends:
<presence/>
Juliet's phone receives:
<presence/>
Juliet's phone receives:
<message from="${Romeo's full JID}" type="chat">
<body>Hello Juliet, are you there?</body>
<delay xmlns='urn:xmpp:delay' from='localhost' stamp='{scansion:any}' />
</message>
# Romeo sends another bare-JID message, it should be delivered
# instantly to Juliet's phone
Romeo sends:
<message to="juliet@localhost" type="chat">
<body>Oh, hi!</body>
</message>
Juliet's phone receives:
<message from="${Romeo's full JID}" type="chat">
<body>Oh, hi!</body>
</message>
# Juliet's laptop goes online, but with a negative priority
Juliet sends:
<presence>
<priority>-1</priority>
</presence>
Juliet receives:
<presence from="${Juliet's full JID}">
<priority>-1</priority>
</presence>
Juliet's phone receives:
<presence from="${Juliet's full JID}">
<priority>-1</priority>
</presence>
# Again, Romeo sends a message to her bare JID, but it should
# only get delivered to her phone:
Romeo sends:
<message to="juliet@localhost" type="chat">
<body>How are you?</body>
</message>
Juliet's phone receives:
<message from="${Romeo's full JID}" type="chat">
<body>How are you?</body>
</message>
# Romeo sends direct to Juliet's full JID, and she should receive it
Romeo sends:
<message to="${Juliet's full JID}" type="chat">
<body>Are you hiding?</body>
</message>
Juliet receives:
<message from="${Romeo's full JID}" type="chat">
<body>Are you hiding?</body>
</message>
# Juliet publishes non-negative presence
Juliet sends:
<presence/>
Juliet receives:
<presence from="${Juliet's full JID}"/>
Juliet's phone receives:
<presence from="${Juliet's full JID}"/>
# And now Romeo's bare JID messages get delivered to both resources
# (server behaviour may vary here)
Romeo sends:
<message to="juliet@localhost" type="chat">
<body>There!</body>
</message>
Juliet receives:
<message from="${Romeo's full JID}" type="chat">
<body>There!</body>
</message>
Juliet's phone receives:
<message from="${Romeo's full JID}" type="chat">
<body>There!</body>
</message>
# The End
Romeo disconnects
Juliet disconnects
Juliet's phone disconnects
|