1
votes

I'm trying to learn XMPP protocol to make web applications using it.

So, I've installed a XMPP daemon called openfire, I configured it to support HTTP-Bind, I can connect to it using Pidgin and the default XMPP protocol.

The problem is that I can't connect to it using HTTP-Binding. In pidgin I have some options when I'm connecting to specify method whici I want to use to connect to server. If I set it to connect using HTTP-Bind it fails with this message: No session id given.

At the client side, I'd use Strophejs try to make this connection, but it doesn't work too. I have something like this:

var conn = new Strophe.Connection("http://chat.dev/http-bind");

Where http://chat.dev/http-bind is the location to the XMPP daemon. I've been forwarded this location to be set on the properly port in apache virtualhost, so the http://chat.dev/http-bind will point to the same thing as http: / / 127.0.0.1:7070.

conn.connect("test5", "test5", some_callback);

function some_callback(status)
{
if (status == Strophe.Status.CONNECTING) {
    console.log('Strophe is connecting.');
} else if (status == Strophe.Status.CONNFAIL) {
    console.log('Strophe failed to connect.');  
} else if (status == Strophe.Status.DISCONNECTING) {
    console.log('Strophe is disconnecting.');
} else if (status == Strophe.Status.DISCONNECTED) {
    console.log('Strophe is disconnected.');
} else if (status == Strophe.Status.CONNECTED) {
    console.log('Strophe is connected.');
 // connection.disconnect();
}
} 

This will return: "Strophe is connecting."

Well, I don't know the answer, I've been reading a book about XMPP and Strophe, but this book doesn't cover this aspect and the documentation which I've found also doesn't help me.

Thanks.

1
Sounds to me like OpenFire is not correctly configured to use BOSH and HTTP-binding.JC Brand
How can I check if this is true?Sorin Vladu
Tell us more about your setup, please. IS your Openfire daemon running on the same host/IP as your web server? On which port do you have your Openfire configured to listen for incoming BOSH connections? Are you loading the Strophe flxhr plugin? Are you able to load the Openfire admin interface in your browser by pointing to http://chat.dev:9090 ?JAAulde
I can access chat.dev:9090, I can log-in intro admin panel. I don't use flxhr.Sorin Vladu

1 Answers

0
votes

Try this- var conn = new Strophe.Connection("http://chat.dev/http-bind/");

Need to put '/' in the end. Worked for me.