Skip to content
This repository
Newer
Older
100644 70 lines (43 sloc) 2.379 kb
5f369eb6 » flosse
2012-01-28 imported 2nd disco plugin
1 # strophe.disco.js
2
3 strophe.disco.js is a plugin to provide Service discovery
4 ( [XEP-0030>](http://xmpp.org/extensions/xep-0030.html) ).
5
6 There are two plugins available.
7
8 ## Plugin A
9
10 This [plugin](strophejs-plugins/tree/master/disco/strophe.disco.js) allows to
11 send disco queries and registers handlers that respond to incoming queries.
12
13 ### Usage
14
15 var c = new Strophe.Connection('bosh-service');
16 c.connect(jid,pw);
17 c.disco.info(jid,callback);
18
19 #### Run Specs
20
21 use node with jasmine-node plugin to run the specs
22
23 ### ToDo
24
25 - cleanup stanza specs using Strophe.Builder instead of strings
26
27 ## Plugin B
28
29 The [plugin](strophejs-plugins/tree/master/disco/public/javascript/strophe.disco.js)
30 facilitates client and server side handling of discovery messages.
31
32 ### Client Side
33
34 The plugin provides to methods (info and items) on top of the disco object that
35 is added to the connection. You use them as follows
36
37 var c = new Strophe.Connection('http://localhost/xmpp-httpbind');
38 c.connect('andi@psi/strophe','andi');
39 c.disco.info('andi@psi/psi');
40
41 You can also pass a node, success and error handlers to the method.
42 The items method behaves in the same way. Just make sure that your success and
43 error handlers are passed after the node (if any).
44
45 ### Server Side
46
47 The module adds response handlers to info and item queries.
48 The disco object added to the connection has members for features and identity
49 that will be used to populate the disco#info response.
50
51 <iq xmlns='jabber:client' from='andi@psi/strophe' to='andi@psi/strophe2' type='result' id='4774:sendIQ'><query xmlns='http://jabber.org/protocol/disco#info'><identity name='strophe'/><feature var='http://jabber.org/protocol/disco#info'/><feature var='http://jabber.org/protocol/disco#items'/></query></iq>
52
53 You can additional nodes using addNode, e.g.
54 c.disco.addNode('aNode', { items: [{node: 'aNode', name: 'aName'}] });
55
56 and then query for them using the items method
57
58 c1.disco.items('andi@psi/strophe', 'aNode', function(s) { console.log(Strophe.serialize(s)) ; } )
59
60 See the specs for details.
61
62 ### Run Specs
63
64 To run the specs you should install jasmine-tool for nodejs via npm and update
65 the references to the external libraries (Strophe, jQuery) in jasmine.json.
66 After that you run
67
68 $> jasmine mon
69
70 and navigate your browser to http://localhost:8124 to view the specs executing.
Something went wrong with that request. Please try again.