XMPP For The Web/Win ::: XMPP-FTW (1.16.8)

XEP-0199 XMPP Ping

Send a ping request

Ping requests are sent as follows, if you don't specify a 'to' address it will use the domain part of the user's JID:

        socket.send(
            'xmpp.ping'
            {
             /* "to": "evilprofessor.co.uk" */
            },
            function(error, data) { console.log(error, data) }
        )
        

On success, `data` will simply be true.

Incoming ping request

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

The data is delivered as follows:

        {
            "from": { "from": "evilprofessor.co.uk" },
            "id": "abc-123"
        }
        

Responding to a ping request

To respond to a ping request the xmpp.ping.pong event is used as follows:

        socket.send(
            'xmpp.ping.pong',
            {
                "to": "evilprofessor.co.uk",
                "id": "abc-123"
            },
            function(error, data) { console.log(error, data) }
        )
        

The callback here is optional but if provided data will simply be true on successful send.

Pages

Fork me on GitHub