@sockethub/platform-xmpp 5.0.0-alpha.4 → 5.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +146 -97
- package/README.md +75 -18
- package/package.json +15 -20
- package/src/incoming-handlers.js +298 -263
- package/src/incoming-handlers.test.data.js +260 -0
- package/src/incoming-handlers.test.js +87 -29
- package/src/index.js +696 -454
- package/src/index.test.js +477 -319
- package/src/schema.js +60 -48
- package/src/utils.js +21 -18
- package/src/utils.test.js +53 -33
- package/.eslintignore +0 -2
- package/coverage/tmp/coverage-39286-1663949499396-0.json +0 -1
- package/src/incoming-handlers.data.js +0 -198
package/API.md
CHANGED
|
@@ -1,50 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
# Members
|
|
2
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
|
-
<a
|
|
46
|
-
|
|
47
|
-
|
|
3
|
+
<dl>
|
|
4
|
+
<dt><a href="#schema">schema</a></dt>
|
|
5
|
+
<dd><p>JSON schema defining the types this platform accepts.</p>
|
|
6
|
+
<p>Actual handling of incoming 'set' commands are handled by dispatcher,
|
|
7
|
+
but the dispatcher uses this defined schema to validate credentials
|
|
8
|
+
received, so that when a @context type is called, it can fetch the
|
|
9
|
+
credentials (<code>session.getConfig()</code>), knowing they will have already been
|
|
10
|
+
validated against this schema.</p>
|
|
11
|
+
<p>In the below example, Sockethub will validate the incoming credentials object
|
|
12
|
+
against whatever is defined in the <code>credentials</code> portion of the schema
|
|
13
|
+
object.</p>
|
|
14
|
+
<p>It will also check if the incoming AS object uses a type which exists in the
|
|
15
|
+
<code>types</code> portion of the schema object (should be an array of type names).</p>
|
|
16
|
+
<p><strong>NOTE</strong>: For more information on using the credentials object from a client,
|
|
17
|
+
see <a href="https://github.com/sockethub/sockethub/wiki/Sockethub-Client">Sockethub Client</a></p>
|
|
18
|
+
<p>Valid AS object for setting XMPP credentials:</p>
|
|
19
|
+
</dd>
|
|
20
|
+
</dl>
|
|
21
|
+
|
|
22
|
+
# Functions
|
|
23
|
+
|
|
24
|
+
<dl>
|
|
25
|
+
<dt><a href="#connect">connect(job, credentials, done)</a></dt>
|
|
26
|
+
<dd><p>Connect to the XMPP server.</p>
|
|
27
|
+
</dd>
|
|
28
|
+
<dt><a href="#join">join(job, done)</a></dt>
|
|
29
|
+
<dd><p>Join a room, optionally defining a display name for that room.</p>
|
|
30
|
+
</dd>
|
|
31
|
+
<dt><a href="#leave">leave(job, done)</a></dt>
|
|
32
|
+
<dd><p>Leave a room</p>
|
|
33
|
+
</dd>
|
|
34
|
+
<dt><a href="#send">send(job, done)</a></dt>
|
|
35
|
+
<dd><p>Send a message to a room or private conversation.</p>
|
|
36
|
+
</dd>
|
|
37
|
+
<dt><a href="#update">update(job, done)</a></dt>
|
|
38
|
+
<dd><p>Indicate presence and status message.
|
|
39
|
+
Valid presence values are "away", "chat", "dnd", "xa", "offline", "online".</p>
|
|
40
|
+
</dd>
|
|
41
|
+
<dt><a href="#request-friend">request-friend(job, done)</a></dt>
|
|
42
|
+
<dd><p>Send friend request</p>
|
|
43
|
+
</dd>
|
|
44
|
+
<dt><a href="#remove-friend">remove-friend(job, done)</a></dt>
|
|
45
|
+
<dd><p>Send a remove friend request</p>
|
|
46
|
+
</dd>
|
|
47
|
+
<dt><a href="#make-friend">make-friend(job, done)</a></dt>
|
|
48
|
+
<dd><p>Confirm a friend request</p>
|
|
49
|
+
</dd>
|
|
50
|
+
<dt><a href="#query">query(job, done)</a></dt>
|
|
51
|
+
<dd><p>Indicate an intent to query something (i.e. get a list of users in a room).</p>
|
|
52
|
+
</dd>
|
|
53
|
+
<dt><a href="#disconnect">disconnect(job, done)</a></dt>
|
|
54
|
+
<dd><p>Disconnect XMPP client</p>
|
|
55
|
+
</dd>
|
|
56
|
+
<dt><a href="#cleanup">cleanup(done)</a></dt>
|
|
57
|
+
<dd><p>Called when it's time to close any connections or clean data before being wiped
|
|
58
|
+
forcefully.</p>
|
|
59
|
+
</dd>
|
|
60
|
+
</dl>
|
|
61
|
+
|
|
62
|
+
<a name="schema"></a>
|
|
63
|
+
|
|
64
|
+
# schema
|
|
48
65
|
JSON schema defining the types this platform accepts.
|
|
49
66
|
|
|
50
67
|
Actual handling of incoming 'set' commands are handled by dispatcher,
|
|
@@ -67,7 +84,7 @@ see [Sockethub Client](https://github.com/sockethub/sockethub/wiki/Sockethub-Cli
|
|
|
67
84
|
|
|
68
85
|
Valid AS object for setting XMPP credentials:
|
|
69
86
|
|
|
70
|
-
**Kind**:
|
|
87
|
+
**Kind**: global variable
|
|
71
88
|
**Example**
|
|
72
89
|
```js
|
|
73
90
|
{
|
|
@@ -86,12 +103,12 @@ Valid AS object for setting XMPP credentials:
|
|
|
86
103
|
}
|
|
87
104
|
}
|
|
88
105
|
```
|
|
89
|
-
<a name="
|
|
106
|
+
<a name="connect"></a>
|
|
90
107
|
|
|
91
|
-
|
|
108
|
+
# connect(job, credentials, done)
|
|
92
109
|
Connect to the XMPP server.
|
|
93
110
|
|
|
94
|
-
**Kind**:
|
|
111
|
+
**Kind**: global function
|
|
95
112
|
<table>
|
|
96
113
|
<thead>
|
|
97
114
|
<tr>
|
|
@@ -100,13 +117,13 @@ Connect to the XMPP server.
|
|
|
100
117
|
</thead>
|
|
101
118
|
<tbody>
|
|
102
119
|
<tr>
|
|
103
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
120
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
104
121
|
</td>
|
|
105
122
|
</tr><tr>
|
|
106
|
-
<td>credentials</td><td><code>object</code></td><td><p>credentials object
|
|
123
|
+
<td>credentials</td><td><code>object</code></td><td><p>credentials object</p>
|
|
107
124
|
</td>
|
|
108
125
|
</tr><tr>
|
|
109
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
126
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
110
127
|
</td>
|
|
111
128
|
</tr> </tbody>
|
|
112
129
|
</table>
|
|
@@ -124,12 +141,12 @@ Connect to the XMPP server.
|
|
|
124
141
|
}
|
|
125
142
|
}
|
|
126
143
|
```
|
|
127
|
-
<a name="
|
|
144
|
+
<a name="join"></a>
|
|
128
145
|
|
|
129
|
-
|
|
146
|
+
# join(job, done)
|
|
130
147
|
Join a room, optionally defining a display name for that room.
|
|
131
148
|
|
|
132
|
-
**Kind**:
|
|
149
|
+
**Kind**: global function
|
|
133
150
|
<table>
|
|
134
151
|
<thead>
|
|
135
152
|
<tr>
|
|
@@ -138,10 +155,10 @@ Join a room, optionally defining a display name for that room.
|
|
|
138
155
|
</thead>
|
|
139
156
|
<tbody>
|
|
140
157
|
<tr>
|
|
141
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
158
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
142
159
|
</td>
|
|
143
160
|
</tr><tr>
|
|
144
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
161
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
145
162
|
</td>
|
|
146
163
|
</tr> </tbody>
|
|
147
164
|
</table>
|
|
@@ -162,12 +179,12 @@ Join a room, optionally defining a display name for that room.
|
|
|
162
179
|
}
|
|
163
180
|
}
|
|
164
181
|
```
|
|
165
|
-
<a name="
|
|
182
|
+
<a name="leave"></a>
|
|
166
183
|
|
|
167
|
-
|
|
184
|
+
# leave(job, done)
|
|
168
185
|
Leave a room
|
|
169
186
|
|
|
170
|
-
**Kind**:
|
|
187
|
+
**Kind**: global function
|
|
171
188
|
<table>
|
|
172
189
|
<thead>
|
|
173
190
|
<tr>
|
|
@@ -176,10 +193,10 @@ Leave a room
|
|
|
176
193
|
</thead>
|
|
177
194
|
<tbody>
|
|
178
195
|
<tr>
|
|
179
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
196
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
180
197
|
</td>
|
|
181
198
|
</tr><tr>
|
|
182
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
199
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
183
200
|
</td>
|
|
184
201
|
</tr> </tbody>
|
|
185
202
|
</table>
|
|
@@ -200,12 +217,12 @@ Leave a room
|
|
|
200
217
|
}
|
|
201
218
|
}
|
|
202
219
|
```
|
|
203
|
-
<a name="
|
|
220
|
+
<a name="send"></a>
|
|
204
221
|
|
|
205
|
-
|
|
222
|
+
# send(job, done)
|
|
206
223
|
Send a message to a room or private conversation.
|
|
207
224
|
|
|
208
|
-
**Kind**:
|
|
225
|
+
**Kind**: global function
|
|
209
226
|
<table>
|
|
210
227
|
<thead>
|
|
211
228
|
<tr>
|
|
@@ -214,10 +231,10 @@ Send a message to a room or private conversation.
|
|
|
214
231
|
</thead>
|
|
215
232
|
<tbody>
|
|
216
233
|
<tr>
|
|
217
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
234
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
218
235
|
</td>
|
|
219
236
|
</tr><tr>
|
|
220
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
237
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
221
238
|
</td>
|
|
222
239
|
</tr> </tbody>
|
|
223
240
|
</table>
|
|
@@ -263,13 +280,13 @@ Send a message to a room or private conversation.
|
|
|
263
280
|
}
|
|
264
281
|
}
|
|
265
282
|
```
|
|
266
|
-
<a name="
|
|
283
|
+
<a name="update"></a>
|
|
267
284
|
|
|
268
|
-
|
|
285
|
+
# update(job, done)
|
|
269
286
|
Indicate presence and status message.
|
|
270
287
|
Valid presence values are "away", "chat", "dnd", "xa", "offline", "online".
|
|
271
288
|
|
|
272
|
-
**Kind**:
|
|
289
|
+
**Kind**: global function
|
|
273
290
|
<table>
|
|
274
291
|
<thead>
|
|
275
292
|
<tr>
|
|
@@ -278,10 +295,10 @@ Valid presence values are "away", "chat", "dnd", "xa", "offline", "online".
|
|
|
278
295
|
</thead>
|
|
279
296
|
<tbody>
|
|
280
297
|
<tr>
|
|
281
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
298
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
282
299
|
</td>
|
|
283
300
|
</tr><tr>
|
|
284
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
301
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
285
302
|
</td>
|
|
286
303
|
</tr> </tbody>
|
|
287
304
|
</table>
|
|
@@ -301,12 +318,12 @@ Valid presence values are "away", "chat", "dnd", "xa", "offline", "online".
|
|
|
301
318
|
}
|
|
302
319
|
}
|
|
303
320
|
```
|
|
304
|
-
<a name="
|
|
321
|
+
<a name="request-friend"></a>
|
|
305
322
|
|
|
306
|
-
|
|
323
|
+
# request-friend(job, done)
|
|
307
324
|
Send friend request
|
|
308
325
|
|
|
309
|
-
**Kind**:
|
|
326
|
+
**Kind**: global function
|
|
310
327
|
<table>
|
|
311
328
|
<thead>
|
|
312
329
|
<tr>
|
|
@@ -315,10 +332,10 @@ Send friend request
|
|
|
315
332
|
</thead>
|
|
316
333
|
<tbody>
|
|
317
334
|
<tr>
|
|
318
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
335
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
319
336
|
</td>
|
|
320
337
|
</tr><tr>
|
|
321
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
338
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
322
339
|
</td>
|
|
323
340
|
</tr> </tbody>
|
|
324
341
|
</table>
|
|
@@ -336,12 +353,12 @@ Send friend request
|
|
|
336
353
|
}
|
|
337
354
|
}
|
|
338
355
|
```
|
|
339
|
-
<a name="
|
|
356
|
+
<a name="remove-friend"></a>
|
|
340
357
|
|
|
341
|
-
|
|
358
|
+
# remove-friend(job, done)
|
|
342
359
|
Send a remove friend request
|
|
343
360
|
|
|
344
|
-
**Kind**:
|
|
361
|
+
**Kind**: global function
|
|
345
362
|
<table>
|
|
346
363
|
<thead>
|
|
347
364
|
<tr>
|
|
@@ -350,10 +367,10 @@ Send a remove friend request
|
|
|
350
367
|
</thead>
|
|
351
368
|
<tbody>
|
|
352
369
|
<tr>
|
|
353
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
370
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
354
371
|
</td>
|
|
355
372
|
</tr><tr>
|
|
356
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
373
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
357
374
|
</td>
|
|
358
375
|
</tr> </tbody>
|
|
359
376
|
</table>
|
|
@@ -371,12 +388,12 @@ Send a remove friend request
|
|
|
371
388
|
}
|
|
372
389
|
}
|
|
373
390
|
```
|
|
374
|
-
<a name="
|
|
391
|
+
<a name="make-friend"></a>
|
|
375
392
|
|
|
376
|
-
|
|
393
|
+
# make-friend(job, done)
|
|
377
394
|
Confirm a friend request
|
|
378
395
|
|
|
379
|
-
**Kind**:
|
|
396
|
+
**Kind**: global function
|
|
380
397
|
<table>
|
|
381
398
|
<thead>
|
|
382
399
|
<tr>
|
|
@@ -385,10 +402,10 @@ Confirm a friend request
|
|
|
385
402
|
</thead>
|
|
386
403
|
<tbody>
|
|
387
404
|
<tr>
|
|
388
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
405
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
389
406
|
</td>
|
|
390
407
|
</tr><tr>
|
|
391
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
408
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
392
409
|
</td>
|
|
393
410
|
</tr> </tbody>
|
|
394
411
|
</table>
|
|
@@ -406,12 +423,12 @@ Confirm a friend request
|
|
|
406
423
|
}
|
|
407
424
|
}
|
|
408
425
|
```
|
|
409
|
-
<a name="
|
|
426
|
+
<a name="query"></a>
|
|
410
427
|
|
|
411
|
-
|
|
412
|
-
Indicate an intent to query something (
|
|
428
|
+
# query(job, done)
|
|
429
|
+
Indicate an intent to query something (i.e. get a list of users in a room).
|
|
413
430
|
|
|
414
|
-
**Kind**:
|
|
431
|
+
**Kind**: global function
|
|
415
432
|
<table>
|
|
416
433
|
<thead>
|
|
417
434
|
<tr>
|
|
@@ -420,10 +437,10 @@ Indicate an intent to query something (ie. get a list of users in a room).
|
|
|
420
437
|
</thead>
|
|
421
438
|
<tbody>
|
|
422
439
|
<tr>
|
|
423
|
-
<td>job</td><td><code>object</code></td><td><p>activity streams object
|
|
440
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
424
441
|
</td>
|
|
425
442
|
</tr><tr>
|
|
426
|
-
<td>done</td><td><code>object</code></td><td><p>callback when job is done
|
|
443
|
+
<td>done</td><td><code>object</code></td><td><p>callback when job is done</p>
|
|
427
444
|
</td>
|
|
428
445
|
</tr> </tbody>
|
|
429
446
|
</table>
|
|
@@ -470,13 +487,45 @@ Indicate an intent to query something (ie. get a list of users in a room).
|
|
|
470
487
|
}
|
|
471
488
|
}
|
|
472
489
|
```
|
|
473
|
-
<a name="
|
|
490
|
+
<a name="disconnect"></a>
|
|
491
|
+
|
|
492
|
+
# disconnect(job, done)
|
|
493
|
+
Disconnect XMPP client
|
|
494
|
+
|
|
495
|
+
**Kind**: global function
|
|
496
|
+
<table>
|
|
497
|
+
<thead>
|
|
498
|
+
<tr>
|
|
499
|
+
<th>Param</th><th>Type</th><th>Description</th>
|
|
500
|
+
</tr>
|
|
501
|
+
</thead>
|
|
502
|
+
<tbody>
|
|
503
|
+
<tr>
|
|
504
|
+
<td>job</td><td><code>object</code></td><td><p>activity streams object</p>
|
|
505
|
+
</td>
|
|
506
|
+
</tr><tr>
|
|
507
|
+
<td>done</td><td></td><td></td>
|
|
508
|
+
</tr> </tbody>
|
|
509
|
+
</table>
|
|
510
|
+
|
|
511
|
+
**Example**
|
|
512
|
+
```js
|
|
513
|
+
{
|
|
514
|
+
context: 'xmpp',
|
|
515
|
+
type: 'disconnect',
|
|
516
|
+
actor: {
|
|
517
|
+
id: 'slvrbckt@jabber.net/Home',
|
|
518
|
+
type: 'person'
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
<a name="cleanup"></a>
|
|
474
523
|
|
|
475
|
-
|
|
524
|
+
# cleanup(done)
|
|
476
525
|
Called when it's time to close any connections or clean data before being wiped
|
|
477
526
|
forcefully.
|
|
478
527
|
|
|
479
|
-
**Kind**:
|
|
528
|
+
**Kind**: global function
|
|
480
529
|
<table>
|
|
481
530
|
<thead>
|
|
482
531
|
<tr>
|
package/README.md
CHANGED
|
@@ -1,32 +1,89 @@
|
|
|
1
1
|
# @sockethub/platform-xmpp
|
|
2
|
-
A Sockethub platform module implementing XMPP functionality.
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
A Sockethub platform module implementing XMPP (Jabber) functionality for instant messaging and presence.
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
This platform provides XMPP client functionality, allowing web applications to connect to
|
|
8
|
+
XMPP servers, send messages, manage contacts, join chat rooms, and handle presence
|
|
9
|
+
updates through ActivityStreams messages.
|
|
6
10
|
|
|
7
11
|
## Implemented Verbs (`@type`)
|
|
8
|
-
<kbd> send</kbd>
|
|
9
|
-
<kbd> request-friend</kbd>
|
|
10
|
-
<kbd> remove-friend</kbd>
|
|
11
|
-
<kbd> make-friend</kbd>
|
|
12
|
-
<kbd> update</kbd>
|
|
13
|
-
<kbd> join</kbd>
|
|
14
|
-
<kbd> observe</kbd>
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
* **send** - Send messages to contacts or chat rooms
|
|
14
|
+
* **join** - Join XMPP chat rooms (MUCs)
|
|
15
|
+
* **observe** - Subscribe to presence updates
|
|
16
|
+
* **request-friend** - Send contact/buddy requests
|
|
17
|
+
* **remove-friend** - Remove contacts from roster
|
|
18
|
+
* **make-friend** - Accept contact requests
|
|
19
|
+
* **update** - Update presence status and information
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
17
22
|
|
|
23
|
+
### Send Message Example
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"@type": "send",
|
|
28
|
+
"context": "xmpp",
|
|
29
|
+
"actor": {
|
|
30
|
+
"@id": "user@example.org"
|
|
31
|
+
},
|
|
32
|
+
"target": {
|
|
33
|
+
"@id": "friend@jabber.net"
|
|
34
|
+
},
|
|
35
|
+
"object": {
|
|
36
|
+
"@type": "Note",
|
|
37
|
+
"content": "Hello from Sockethub!"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
18
40
|
```
|
|
41
|
+
|
|
42
|
+
### Join Chat Room Example
|
|
43
|
+
|
|
44
|
+
```json
|
|
19
45
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
actor: {
|
|
23
|
-
|
|
46
|
+
"@type": "join",
|
|
47
|
+
"context": "xmpp",
|
|
48
|
+
"actor": {
|
|
49
|
+
"@id": "user@example.org"
|
|
24
50
|
},
|
|
25
|
-
target: {
|
|
26
|
-
|
|
51
|
+
"target": {
|
|
52
|
+
"@id": "room@conference.example.org"
|
|
27
53
|
}
|
|
28
54
|
}
|
|
29
55
|
```
|
|
30
56
|
|
|
57
|
+
### Request Friend Example
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"@type": "request-friend",
|
|
62
|
+
"context": "xmpp",
|
|
63
|
+
"actor": {
|
|
64
|
+
"@id": "user@example.org"
|
|
65
|
+
},
|
|
66
|
+
"target": {
|
|
67
|
+
"@id": "friend@jabber.net"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
|
|
74
|
+
* **Instant messaging**: Send and receive one-on-one messages
|
|
75
|
+
* **Multi-user chat**: Join and participate in chat rooms (MUCs)
|
|
76
|
+
* **Contact management**: Add, remove, and manage contact lists
|
|
77
|
+
* **Presence**: Handle online/offline status and presence updates
|
|
78
|
+
* **Authentication**: Support for various XMPP authentication methods
|
|
79
|
+
|
|
80
|
+
## Use Cases
|
|
81
|
+
|
|
82
|
+
* **Web-based chat**: Build XMPP chat clients in web browsers
|
|
83
|
+
* **Integration platforms**: Connect web services to XMPP networks
|
|
84
|
+
* **Notification systems**: Send alerts through XMPP messages
|
|
85
|
+
* **Federated communication**: Connect to the decentralized XMPP network
|
|
86
|
+
|
|
31
87
|
## API
|
|
32
|
-
|
|
88
|
+
|
|
89
|
+
Detailed API documentation can be found [here](API.md)
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sockethub/platform-xmpp",
|
|
3
3
|
"description": "A sockethub platform module implementing XMPP functionality",
|
|
4
|
-
"version": "5.0.0-alpha.
|
|
4
|
+
"version": "5.0.0-alpha.6",
|
|
5
5
|
"private": false,
|
|
6
|
+
"type": "module",
|
|
6
7
|
"author": "Nick Jennings <nick@silverbucket.net>",
|
|
7
8
|
"license": "LGPL-3.0+",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
8
12
|
"main": "src/index.js",
|
|
13
|
+
"engines": {
|
|
14
|
+
"bun": ">=1.2"
|
|
15
|
+
},
|
|
9
16
|
"keywords": [
|
|
10
17
|
"sockethub",
|
|
11
18
|
"messaging",
|
|
@@ -22,20 +29,16 @@
|
|
|
22
29
|
},
|
|
23
30
|
"homepage": "https://github.com/sockethub/sockethub/tree/master/packages/platform-xmpp",
|
|
24
31
|
"dependencies": {
|
|
25
|
-
"@xmpp/client": "^0.13.
|
|
32
|
+
"@xmpp/client": "^0.13.1"
|
|
26
33
|
},
|
|
27
34
|
"devDependencies": {
|
|
28
|
-
"@sockethub/schemas": "
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"jsdoc-to-markdown": "7.1.1",
|
|
33
|
-
"mocha": "10.0.0",
|
|
34
|
-
"proxyquire": "2.1.3",
|
|
35
|
-
"sinon": "14.0.0"
|
|
35
|
+
"@sockethub/schemas": "3.0.0-alpha.6",
|
|
36
|
+
"@xmpp/xml": "0.13.3",
|
|
37
|
+
"jsdoc-to-markdown": "8.0.0",
|
|
38
|
+
"sinon": "17.0.1"
|
|
36
39
|
},
|
|
37
40
|
"peerDependencies": {
|
|
38
|
-
"@sockethub/server": "
|
|
41
|
+
"@sockethub/server": "5.0.0-alpha.6"
|
|
39
42
|
},
|
|
40
43
|
"peerDependenciesMeta": {
|
|
41
44
|
"@sockethub/server": {
|
|
@@ -43,15 +46,7 @@
|
|
|
43
46
|
}
|
|
44
47
|
},
|
|
45
48
|
"scripts": {
|
|
46
|
-
"build": "yarn run doc",
|
|
47
|
-
"clean": "npx rimraf coverage",
|
|
48
|
-
"clean:deps": "npx rimraf node_modules",
|
|
49
|
-
"compliance": "yarn run test && yarn run coverage",
|
|
50
|
-
"test": "c8 mocha **/*.test.js",
|
|
51
|
-
"lint": "eslint \"**/*.js\"",
|
|
52
|
-
"lint:fix": "eslint --fix \"**/*.js\"",
|
|
53
|
-
"coverage": "c8 check-coverage --statements 85 --branches 80 --functions 70 --lines 85",
|
|
54
49
|
"doc": "jsdoc2md --no-gfm --heading-depth 1 src/index.js > API.md"
|
|
55
50
|
},
|
|
56
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "f8a937e071e7a209f94b94f63e68faa27784e00e"
|
|
57
52
|
}
|