Question

How do I extract the SID and RID values used in the BOSH transport protocol for XMPP? Specifically, I'm using xmpphp.

Was it helpful?

Solution

I've done quite a bit of work on XMPPHP especially the BOSH part of it (which until recently didn't even work). http://github.com/Wordi/xmpphp

In my case, I'm using it to bootstrap a UI client and provide auto-login capability for XMPP BOSH.

class Library_BOSH extends XMPPHP_BOSH
{

    public function getAutoLoginInfo()
    {
        return array(
            "jid" => $this->fulljid,
            "rid" => $this->rid,
            "sid" => current( $this->sid )
        );
    }

    //we want to block saving the BOSH session into our $_SESSION,
    //since we're just using it to bootstrap the UI client
    public function saveSession(){;}

}

$bosh = new Library_BOSH(
    $server_address, $server_port,
    $jid, $password,
    NULL, NULL, FALSE, XMPPHP_Log::LEVEL_VERBOSE
);

$bosh->connect( "http://myboshdomain.com/http-bind/", 60 );
$bosh->processUntil('session_start', 5);

$bosh_info = $bosh->getAutoLoginInfo();

OTHER TIPS

Are you looking to extract the "sid" and "rid" for your connected bosh client? If yes, generally these are saved in php sessions or browser cookies. I haven't used xmpphp, but you can just try to dump client's session info to see it's content.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top