I have used the example from crossdomain to connect to my local openfire xmpp service. Just changes the BOSH url to accomodate my local openfire service.
What I tested so I know openfire itself works. I can successfully connect with Pidgin.
(The site runs within jetty)
The (actual) openfire installation runs on localhost
The strophe javascript gets executed after the form is submitted form field: #jid = 'admin@localhost' form field: #pass = 'mypassword'
The functions rawInput and rawOutput are omitted they are simply logging what is transferred.
var BOSH_SERVICE=http://localhost:8080/xmpp-bosh
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();
}
});
});
There is an error when connecting the example gives me the following log output:
Strophe is connecting.
SENT: <body rid='4005617322' xmlns='http://jabber.org/protocol/httpbind' to='localhost' 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' authid='' condition='remote-stream-error' inactivity='600' polling='10' requests='2' secure='false' sid='orw55e6kuyZ0F-CFgnxXWMzG' type='terminate' wait='60'><starttls xmlns=''/><mechanisms xmlns=''><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns=''><method>zlib</method></compression><auth xmlns=''/><register xmlns=''/></body>
Strophe failed to connect.
Strophe is disconnected.
Any ideas how to overcome this issue? ( have tested with pidgin IM and works )