Problems with punjab in a local network (solved)
Written by: daniel
September 12, 2009
I have been using punjab for a while as an interface for BOSH protocol between my browser Strophe applications and other xmpp clients. This worked perfectly until the (sad) day I had no internet connection. Suddenly I could not connect through punjab with a local ejabberd server and got very confusing “not authorized” error messages.
I double checked all configuration data and do a couple of tests and debugging until I found out what the problem was.
Apparently punjab tries to resolve any domain in your usernames using a dns server. That is unfortunately true even for “localhost”. Moreover, it totally ignores your /etc/hosts file (or at least I did not know how to make it use it), so until you are ready to deploy a local dns server, you cannot use it without an internet connection.
I was about to give up, when I found out that ejabberd had a native module for BOSH connections, (which btw I had know about and it had given me a lot of troubles when I had tried to use it months ago)
Fortunately, this time everything went very smoothly. All I did was uncommenting the line:
{mod_http_bind, []}
restarted ejabberd and when I accessed:
http://localhost:5280/http-bind
I could see the BOSH interface response. Boy! That was easy.
I had to change a little bit the apache proxy module configuration and it worked perfectly.
On the other hand, the native ejabberd http bind module is said to have better performance than punjab (which is not very surprising after all). Check out this post to find out more.
EDIT: September, 12th
I have checked the setup with punjab, having internet connection activated and it is still not working, so I guess I was wrong about this being a dns server issue. Or maybe it has some problem with “localhost” being the ejabberd domain? I will post here any news.
EDIT: September, 19th
I was wrong! Thanks to some helpful hints from Tofu the REAL problem could be identified as some bug in Strophe. I was using some old version (although it’s hard to trace as there seems to be no version number in the file) and when I changed it to the one I just downloaded - voilá! It worked! The lessons learned are:
- check if you use the latest version. bugs are fixed all the time.
- sometimes (especially with many components in the middle) error messages (and even initial tests) may be misleading and testing each component separately or in different configurations may help isolate the problem.
Posted in



September 12th, 2009 at 5:38 pm
What version of punjab did you try?
localhost should work with the latest version. And it should not be ignoring /etc/hosts.
What version of twisted?
It would be nice to fix this bug for you.
I will add that the newest version of http_bind in ejabberd is better. The old version however is not.
They both have their purpose. Punjab can connect to any xmpp server while you can not do this with http_bind.
Currently, Punjab’s main performance issue is memory and its being addressed.
Next time don’t hesitate to ask a question on the mailing-list.
http://groups.google.com/group/punjab-xmpp
September 12th, 2009 at 9:45 pm
Hi Tofu,
thanks for your comment. good point about punjab being able to connect to any server, not just the local one.
I used punjab 0.13 which is the latest version, isn’t it?
Twisted 8.2.0-2 package on ubuntu.
Still, I may have just not configured it properly. I don’t have too much experience with twisted (mostly using wokkel or flumotion).
Anyway for these small local projects I am doing right now, performance it’s not a big issue at the moment, but it’s good to know which are the strong and week points of each solution.
Thanks for the link to the punjab mailing list, the problem was I had no external connection at the moment so I could not check.
I’ll be happy to test it again when this problem is fixed, I can provide you with more info about the error message I was getting if it helps. It was some dns twisted component problem, indeed.
thanks!
daniel
September 13th, 2009 at 4:54 pm
0.13 has the fix. What was your xmpp hostname? It should have tried to attempt that hostname. Was there a traceback? It would be great if you could send a log to the mailing or email me at tofu at collecta.com
I understand why this would be frustrating and I dont want it to happen to something else.