"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sendPing = sendPing;
var _client = require("@xmpp/client");
function sendPing(client, to, id) {
  if (client.status !== 'online' || client._status === 'closing' || client._status === 'closed') {
    return null;
  }
  const pingId = id || 'ping-' + Date.now() + '-' + Math.floor(Math.random() * 10000);
  const pingStanza = (0, _client.xml)('iq', {
    type: 'get',
    to,
    id: pingId
  }, (0, _client.xml)('ping', 'urn:xmpp:ping'));
  client.send(pingStanza);
  return pingId;
}
//# sourceMappingURL=sendPing.xmpp.js.map