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.
socket.on('xmpp.ping', function(data) { console.log(data) })
The data is delivered as follows:
{ "from": { "from": "evilprofessor.co.uk" }, "id": "abc-123" }
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.