문제

I am trying to use the punjab connection manager with Openfire. I have an already running Openfire server. I have also installed punjab and the server starts properly, allowing me to navigate to the port 5280 on localhost. (Although http://localhost:5280/http-bind gives a "resource not found message".) I am not sure how to proceed from here. I have enabled a setting in the openfire admin console under connection managers that says "Connection managers can connect to this server. " .

How to configure punjab to connect with the xmpp server ?

So far I was directly establishing a bosh connection to the server using xmpp stophe lib and proxy module in apache. Now I wish to use punjab.

도움이 되었습니까?

해결책

I had the same question yesterday and was able to work it out.

It is right - you do not need any configuration of punjab. By default punjab will work on port 5280. Punjab directs stanzas to the desired server automatically.

<body rid='123' xmlns='http://jabber.org/protocol/httpbind' to='yourdomain.tld' 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'/>

This is a stanza used to setup a connection via BOSH. You can see the 'to' Attribute. Punjab can tell from this what XMPP server to speak to.

Forget the connection manager setup stuff in Openfire. You can keep this feature completely disabled. That is because punjab uses a normal XMPP connection to Openfire - just as a usual client does - it talks on the default port 5222.

So all you have to do is

  • tell punjab what url to listen to
  • proxy BOSH requests to that url on punjab default port 5280

Tell punjab what url to listen to

In the punjab.tac file there is a line that says

root.putChild('bosh', b) # url for BOSH

So 'bosh' will be a part of the URL that strophe has to send its stanzas to, which will then be http://www.yourdomain.tld/bosh. The '/bosh' could also be '/http-bind' or '/xmpp-httpbind', but your punjab.tac file has to know this.

Proxy BOSH requests to that url on punjab default port 5280

Next your webserver has to handle the requests directed to '/bosh' and proxy them to punjab on port 5280. Suppose you use Apache, then in your virtual host configuration something like this would do the job:

<IfModule proxy_http_module>
    ProxyRequests Off 
    ProxyPass /bosh http://localhost:5280/bosh
    ProxyPassReverse /bosh http://localhost:5280/bosh
</IfModule>

다른 팁

I did the same thing and it worked at my end too. Thanks for the detailed explanation.

To add to it, the main reason for the confusion in my case was that I am using different virtual hosts for different projects and multiple projects use the same xmpp server. More over, although the server is installed on localhost, its not named localhost. So if anyone is facing similar problems then you need to add route='xmpp:server:port' (eg route='xmpp:127.0.0.1:5222' in my case) to all the request otherwise punjab would not be able to direct the stanzas automatically to the server

@Joe:

I think you should write a Strophe.js plugin that would add the correct route attribute (route='xmpp:dev.mydomain.com:5222') to your xmpp requests... I will try and guide you in doing that when I get back from work.

Looks like your application can speak with punjab, but punjab does not know where to route your xmpp requests.

A good way to understand why your application hangs on Connecting would be to read this: http://xmpp.org/extensions/xep-0124.html searching for bits about route :)

I used Punjab ages back but from my knowledge of how bosh connection managers work, i don't think your server would require any special setting for allowing Punjab to access it. For instance I use a custom connection manager written in PHP (using Jaxl library) which irrespective of type/kind/version of the destination jabber server is able to successfully communicate with them.

In your case you can simple start proxying your strophe requests (using apache proxy module) to http://localhost:5280/http-bind , where 5280 is handled by Punjab conn. manager. From their on it should be able to work your way out to destination server without any special configuration required at the server.

I suggest you to first try connecting to your gmail or facebook account using Punjab to make sure you have it configured correctly.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top