Tuesday, July 19, 2011

Why Strophe.js & Openfire Doesn't work with BlackBerry OS 5?

Recently I have developed a social application on BlackBerry smartphone (9300 curve and 9800 Torch). I have used "Strophe" javascript chat client with Openfire XMPP server for the implementaiton. One of the interesting behaviour I found was the DOM Parser implementation difference between BlackBerry OS 5 and OS 6 versions.

I have initiallly developed the applicaton based on OS 6 (Torch 9800) and everything was working fine.
When I tested the same application in 9300 Curve (OS 5), I found the application is not working as expected.
First, I thought the AJAX is not supported in OS 5 and that is the reason Strophe is not working. But I have tested with a different AJAX service and it works. The same error was repeating in Blackberry 9550 Storm and 9700 Bold.

The error I was getting was "Bad Request" and in the Openfire server the warning log says, "Body is missing in the request". Then I digged little deeper in Strophe and found that Both OS 5 and OS 6 are sending the same XMPP xml messages but the only difference is that the first is converting all the XML tags to upper case! and Openfire server was not liking it. Then in the Strophe.js file, I have converted all the xml tags to lowercase and then everything started working in Blackberry OS 5.

njoy
Sajith

3 comments:

TimKing said...

Yes I found this as well but fixed it by completing the half-finished _realname attribute already there to do this. Just add node.setAttribute("_realname",name) after Strophe creates the element.

But I get the wrong rid and various other errors - did you get this to work properly?

Volkan Ozcelik said...

Thanks buddy!

You made my day.
Your observation helped us save hours of developer time.

Thank you very much.

Manoj Kumar said...

Hello,
We are making chat client on java script for blackberry(os 6.0.0) by using strophe.js. We have setup chat server openfire and trophyim.0.3 on locally over my server.
When I run on device and get the result as below.

1. Strophe is connecting.
2. _connect_cb was called

After this, get don't get any response.

Can you guide me what should I do or how should resolve this problem.


Please help me!.
Thanks in advance.