Пример #1
0
<?php

if (!(isset($_COOKIE['boshJid']) && isset($_COOKIE['boshSid']) && isset($_COOKIE['boshRid']) && isset($_COOKIE['boshUrl']))) {
    require '../../lib/XmppBosh.php';
    $boshUrl = 'http://example.com/http-bind/';
    // BOSH url
    $domain = 'example.com';
    // XMPP host
    $xmppBosh = new XmppBosh($domain, $boshUrl, '', false, false);
    $xmppBosh->connect();
    // For anonymous set node = null and password = null
    $boshSession = $xmppBosh->getSessionInfo();
    setcookie('boshJid', $boshSession['jid'], 0, '/');
    setcookie('boshSid', $boshSession['sid'], 0, '/');
    setcookie('boshRid', $boshSession['rid'], 0, '/');
    setcookie('boshUrl', $boshSession['url'], 0, '/');
}
?>
<html>
    <head>
        <title>Anonymous XMPP connection</title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
        <script type="text/javascript" src='https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js'></script>
        <script type="text/javascript" src='../../js/XmppBosh.js'></script>
        <script type="text/javascript" src='anonymous.js'></script>
    </head>

    <body>
        <button id="disconnect">Disconnect</button>
        <br>
Пример #2
0
function prebind()
{
    $username = get_pconfig(local_channel(), 'converse', 'username');
    $password = get_pconfig(local_channel(), 'converse', 'password');
    $domain = get_config('converse', 'domain');
    $bosh_url = get_config('converse', 'bosh_url');
    $xmppBosh = new XmppBosh($domain, $bosh_url, 'converse-hubzilla', strpos($bosh_url, 'https://') > 0 ? true : false);
    $xmppBosh->connect($username, $password);
    return $xmppBosh->getSessionInfo();
}
Пример #3
0
<?php

if (!(isset($_COOKIE['boshJid']) && isset($_COOKIE['boshSid']) && isset($_COOKIE['boshRid']) && isset($_COOKIE['boshUrl']))) {
    require '../../lib/XmppBosh.php';
    $boshUrl = 'http://example.com/http-bind/';
    // BOSH url
    $domain = 'example.com';
    // XMPP host
    $xmppBosh = new XmppBosh($domain, $boshUrl, '', false, false);
    $node = 'node';
    // Without @example.com
    $password = '******';
    $xmppBosh->connect($node, $password);
    $boshSession = $xmppBosh->getSessionInfo();
    setcookie('boshJid', $boshSession['jid'], 0, '/');
    setcookie('boshSid', $boshSession['sid'], 0, '/');
    setcookie('boshRid', $boshSession['rid'], 0, '/');
    setcookie('boshUrl', $boshSession['url'], 0, '/');
}
?>
<html>
    <head>
        <title>Basic XMPP connection</title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
        <script type="text/javascript" src='https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js'></script>
        <script type="text/javascript" src='../../js/XmppBosh.js'></script>
        <script type="text/javascript" src='basic.js'></script>
    </head>

    <body>
        <button id="disconnect">Disconnect</button>