Get XMPP SID and RID from BOSH in PHP?
Ho开发者_Go百科w do I extract the SID and RID values used in the BOSH transport protocol for XMPP? Specifically, I'm using xmpphp.
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();
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.
精彩评论