Frage

I want to send an iq query to xmpp and need a result that response from XMPP. For example:

<iq from='capulet.lit' to='juliet@capulet.lit/balcony' id='s2c1' type='get'>
  <ping xmlns='urn:xmpp:ping'/>
</iq>

Howerver i find all documents in http://jaxl.readthedocs.org/en/latest/users/xmpp_extensions.html and cant find the way to do that. So hope that someone can help me. Thanks

War es hilfreich?

Lösung

First off, their docs are almost entirely non-existent. File a bug, or better yet, send them a pull request.

For pings in particular:

$client->require_xep(array(
    '0199'  // XMPP Ping
));

If you want to write your own protocols, look at their XEP-0199 implementation for an example:

public function get_ping_pkt() {
    $attrs = array(
        'type'=>'get',
        'from'=>$this->jaxl->full_jid->to_string(),
        'to'=>$this->jaxl->full_jid->domain
    );

    return $this->jaxl->get_iq_pkt(
        $attrs,
        new JAXLXml('ping', NS_XMPP_PING)
    );
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top