I'm trying to connect to a Openfire XMPP server on localhost via Strophe. I can connect to the server with Pidgin. I set up http-binding and CORS (crossdomain.xml generated by Openfire). I can access http://localhost:7070/http-bind/.
However, if I'm trying to connect the standard Firefox console says, that there is a CORS problem. When I take a look with Firebug however, it seems to work, but it fails to connect. Here are the replies I get from the server:
My javascript is the following:
$(document).ready( function () {
var settings = {
bosh: 'http://ift.tt/1rVt86y',
server: 'localhost',
user: 'admin',
pass: 'admin'
};
var connection = new Strophe.Connection(settings.bosh);
connection.connect(settings.user + '@' + settings.server, settings.pass, connect(status));
function connect (status) {
if(status == Strophe.Status.CONNECTING) {
console.log("Connecting");
}
else if (status == Strophe.Status.CONNFAIL) {
console.log("Connection failed");
}
else if (status == Strophe.Status.DISCONNECTING) {
console.log("Disconnecting");
}
else if (status == Strophe.Status.DISCONNECTED) {
console.log("Disconnected");
}
else if (status == Strophe.Status.CONNECTED) {
console.log("Connected");
}
}
});
connect() obviously is being called, but the status variable is empty.
Aucun commentaire:
Enregistrer un commentaire