0

如何提取用于 XMPP的BOSH 传输协议中的 SID 和 RID 值?具体来说,我正在使用xmpphp

4

2 回答 2

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();
于 2010-09-13T18:33:40.933 回答
0

您是否要为连接的 bosh 客户端提取“sid”和“rid”?如果是,通常这些保存在 php 会话或浏览器 cookie 中。我没有使用过 xmpphp,但您可以尝试转储客户端的会话信息以查看其内容。

于 2010-09-12T22:52:42.303 回答