如何提取BOSH transport protocol中用于XMPP的SID和RID值?具体来说,我正在使用xmpphp。
答案 0 :(得分:2)
我在XMPPHP上做了很多工作,尤其是它的BOSH部分(直到最近才开始工作)。 http://github.com/Wordi/xmpphp
就我而言,我正在使用它来引导UI客户端并为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();
答案 1 :(得分:0)
您是否希望为已连接的波什客户端提取“sid”和“rid”?如果是,通常将这些保存在php会话或浏览器cookie中。我没有使用过xmpphp,但您可以尝试转储客户端的会话信息以查看其内容。