user434366
user434366

Reputation: 569

Get XMPP SID and RID from BOSH in PHP?

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

Upvotes: 0

Views: 3657

Answers (2)

Kendall Hopkins
Kendall Hopkins

Reputation: 44104

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();

Upvotes: 2

Abhinav Singh
Abhinav Singh

Reputation: 2651

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.

Upvotes: 0

Related Questions