XMPP For The Web/Win ::: XMPP-FTW (1.18.0) Flattr this

XEP-0030 Service Discovery (DISCO)

Note: Both xmpp.discover.info and xmpp.discover.items support RSM as outlined in result set management.

Discover Entities disco#items

        socket.send(
            'xmpp.discover.items',
            {
                "of": "evilprofessor.co.uk",
             /* "node": "xmpp-ftw updates" */
            },
            function(error, data) { console.log(error, data) }
        )
        

Example response:

        [
            { jid: "conference.evilprofessor.co.uk" },
            { jid: "conference.evilprofessor.co.uk", node: "posts" }
        ]
        

Discover Features disco#info

        socket.send(
            'xmpp.discover.info',
            {
                "of": "evilprofessor.co.uk",
             /* "node": "xmpp-ftw updates" */
            },
            function(error, data) { console.log(error, data) }
        )
        

Example response:

        [
            { "kind": "identity", "type": "pep", "name": "Prosody", "category": "pubsub" },
            { "kind": "identity", "type": "im", "name": "Prosody", "category": "server" },
            { "kind": "feature", "var": "jabber:iq:register" },
            { "kind": "feature", "var": "vcard-temp" },
            { "kind": "feature", "var": "http://jabber.org/protocol/commands" },
            { "kind": "feature", "var": "jabber:iq:roster" },
            { "kind": "form", "form": {} }
        ]
        

Features your client supports

        socket.on('xmpp.discover.client', function(data) {
            console.log(data)
        })
        

Example data sent from server:

        {
            from: 'lloyd@evilprofessor.co.uk/laptop',
            id: 'discover:1'
        }
        

In order to send a reply we use the `xmpp.discover.client` event as follows:

        socket.send(
            'xmpp.discover.client',
            {
                to: 'lloyd@evilprofessor.co.uk/laptop',
                id: 'discover:1',
                features: [
                    { "kind": "identity", "type": "pc", "name": "xmpp-ftw", "category": "client" },
                    { "kind": "feature", "var": "http://jabber.org/protocol/disco#info" },
                    { "kind": "feature", "var": "http://jabber.org/protocol/muc" }
                ]
            },
            function(error, data) { console.log(error, data) }
        )
        

features is optional, or can be an array with zero or more elements.

Providing a callback to this call is optional. If provided you will simply receive an true if the result was sent ok. If the data provided is invalid the error argument will be populated. Should you not provide a callback then the `xmpp.error.client` event will be used.

Pages

Fork me on GitHub