0

I am trying to create a client chat. I could able to to see the log of punjab server as Sending - Receiving. But never showing as Strophes Connected Did the following setup

1)Setup an Xmpp server

wget -O openfire.deb http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3.9.3_all.deb and completed the setup as described in https://www.digitalocean.com/community/tutorials/how-to-install-openfire-xmpp-server-on-a-debian-or-ubuntu-vps Now the openfire is accessble at *****xmppserver.com

2)setup Punjab Bosh Server in the same server By downloading from the github

https://github.com/twonds/punjab/blob/master/INSTALL.txt

and started running by twistd -ny punjab.tac

in etc/hosts added as

127.0.0.1 *****xmppserver.com

3) Finally downloaded latest strophes.js and edited basic.js

var BOSH_SERVICE = 'http://*****xmppserver.com:5280/http-bind';

The output is showing as connecting and never goes to connected!!

function onConnect(status) {
        console.log(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.');
            log('Send a message to ' + connection.jid +
            ' to talk to me.');

            connection.addHandler(onMessage, null, 'message', null, null,  null);
            connection.send($pres().tree());
        }
    }

enter image description here

guny
  • 197
  • 4
  • 19
  • Never used Punjab, but Openfire has its own built in BOSH conn manager. You can enable it on Openfire's admin panel: Server > Server Settings > HTTP Binding. Try with it at your 'http://*****xmppserver.com:7070/http-bind/'. – Uluk Biy Jul 03 '14 at 08:08
  • tried that too but got the following error XMLHttpRequest cannot load http://******xmppserver:7070/http-bind. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. – guny Jul 03 '14 at 08:40
  • Which server are you running at localhost? If Apache then add proxy something like `ProxyPass /http-bind http://******xmppserver:7070/http-bind` and `ProxyPassReverse /http-bind http://******xmppserver:7070/http-bind`. – Uluk Biy Jul 03 '14 at 09:03
  • 1
    Then your bosh url will be `http://localhost/http-bind/`, and note the extra "/" at the end of http-bind. It is crucial for Strophe. – Uluk Biy Jul 03 '14 at 09:05
  • the extra "/" was the issue. with 7070 every thing works fine :) and didnt add any ProxyPass to apache server, my basic doubt is that for y we place bosh punjab in between – guny Jul 03 '14 at 09:26

1 Answers1

0

You can try with the Openfire's built in BOSH http connection manager. Enable it on Openfire's admin panel:
Server > Server Settings > HTTP Binding, then the BOSH URL should be like

var BOSH_SERVICE = 'http://*****xmppserver.com:7070/http-bind/';

Putting a / at the end of /http-bind is crucial for Strophe.

Uluk Biy
  • 48,655
  • 13
  • 146
  • 153
  • can u pls change it to 7070 instead of 5280 i tried with 5280 but didn't get. 7070 is working fine – guny Jul 03 '14 at 10:08