我想通过 Strophe 连接到 xmmp,我已经配置了任何东西
我在我的系统上使用 WAMP 来运行 localhost php
我在 openfire admin 中启用了脚本语法
我已将 APACHE httpd.conf 配置为
# XMPP proxy rule
ProxyRequests Off
ProxyPass /xmpp-httpbind http://127.0.0.1:7070/http-bind/
ProxyPassReverse /xmpp-httpbind http://127.0.0.1:7070/http-bind
我也使用基本的 javascript 文件连接到服务器,所以代码在这里
var BOSH_SERVICE = '/xmpp-httpbind'
var connection = null;
function log(msg)
{
$('#log').append('<div></div>').append(document.createTextNode(msg));
}
function rawInput(data)
{
log('RECV: ' + data);
}
function rawOutput(data)
{
log('SENT: ' + data);
}
function onConnect(status)
{
if (status == Strophe.Status.CONNECTING) {
log('Strophe is connecting.');
} else if (status == Strophe.Status.CONNFAIL) {
log('Strophe failed to connect.');
$('#connect').get(0).value = 'connect';
} else if (status == Strophe.Status.DISCONNECTING) {
log('Strophe is disconnecting.');
} else if (status == Strophe.Status.DISCONNECTED) {
log('Strophe is disconnected.');
$('#connect').get(0).value = 'connect';
} else if (status == Strophe.Status.CONNECTED) {
log('Strophe is connected.');
connection.disconnect();
}
}
$(document).ready(function () {
connection = new Strophe.Connection(BOSH_SERVICE);
connection.rawInput = rawInput;
connection.rawOutput = rawOutput;
$('#connect').bind('click', function () {
var button = $('#connect').get(0);
if (button.value == 'connect') {
button.value = 'disconnect';
connection.connect($('#jid').get(0).value,
$('#pass').get(0).value,
onConnect);
} else {
button.value = 'connect';
connection.disconnect();
}
});
});
当我想与 "admin@127.0.0.1" 连接时,我会进行 AUTHFAIL ,即使在使用 "admin" 之后,我也会收到以下响应:
JID: 密码:
Strophe is connecting.
SENT: <body rid='1613006691' xmlns='http://jabber.org/protocol/httpbind' to='admin' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams' authid='2ff1799d' sid='2ff1799d' secure='true' requests='2' inactivity='30' polling='5' wait='60' hold='1' ack='1613006691' maxpause='300' ver='1.6'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body>
SENT: <body rid='1613006692' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='ANONYMOUS'/></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body>
SENT: <body rid='1613006693' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d' to='admin' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body>
SENT: <body rid='1613006694' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d'><iq type='set' id='_bind_auth_2' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_bind_auth_2' to='pedram-pc/2ff1799d'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>2ff1799d@pedram-pc/2ff1799d</jid></bind></iq></body>
SENT: <body rid='1613006695' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d'><iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_session_auth_2' to='2ff1799d@pedram-pc/2ff1799d'/></body>
Strophe is connected.
Strophe is disconnecting.
SENT: <body rid='1613006696' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d' type='terminate'><presence xmlns='jabber:client' type='unavailable'/></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'/>
Strophe is disconnected.
我的问题在哪里?