簡體   English   中英

在PHP中從BOSH獲取XMPP SID和RID?

[英]Get XMPP SID and RID from BOSH in PHP?

如何提取用於XMPP的BOSH傳輸協議中使用的SID和RID值? 具體來說,我正在使用xmpphp

我已經在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();

您是否要為連接的Bosh客戶端提取“ sid”和“ rid”? 如果是,通常將它們保存在php會話或瀏覽器cookie中。 我沒有使用過xmpphp,但是您可以嘗試轉儲客戶端的會話信息以查看其內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM