Solution for inconsistent or unreliable responses from openfire 3.6.0a

For those out there playing with XIFF 3.0.0-beta1 and Openfire 3.6.0.a this tip may help you.

When i first got started using XIFF, i noticed incredibly flaky responses from openfire. Sometimes i’d receive presence packets and message packets, but then often times i would not! It was very unreliable and driving me quite mad.

If anyone has experienced this, I feel your frustration and offer you this line of code which made XIFF and openfire talk wonderfully for me:

Rather than connecting like so:

var connection:XMPPSocketConnection;

vconnection = new XMPPSocketConnection();

connection.username = “username”;
connection.password = “password”;
connection.server = “hostname”;
connection.port = 5222;
connection.resource = “resourceName”;

connection.connect(“flash”);

Use this instead:

var connection:XMPPSocketConnection;

vconnection = new XMPPSocketConnection();

connection.username = “username”;

connection.password = “password”;

connection.server = “hostname”;

connection.port = 5222;

connection.resource = “resourceName”;

connection.connect();

For some reason using the “flash” streamType when talking to openfire creates very unreliable communication.

Hope this helps someone!

Hi there,

Thanks for the post. I just want to let everyone know that I omitted the streamType argument at first (which makes it “terminatedStandard”, the default) but this didn’t work out for me. I had to set it to “flash” to make the server respond. My advice is to try both and see which one works for you (meaning: for your server).

Yes, this is a very annoying problem in Adobe AS3/Flex 2. I did some research on the subject today. When using a sniffer you can see that openfire sends multiple iq messages in one TCP packet. The messages are separated with a null byte.

However, Adobe’s XMLSocket stops reading the Socket after the null byte. So all messages within the same packet are ignored.

Here is an example sniff from Wireshark:

348     159.824971     xx.xx.xx.xx     192.168.1.13     Jabber/XML     Response: <iq type="result" id="iq_25" from="groupname@component.localhost.xmpp.xxx.xx" to="username_242e8112_de33@xmpp.xxx.xx/xxxxxx"><query><properties><property name="action">xxxx</property></properties></query></iq>\000<iq type="result" id="iq_27" from="groupname@component.localhost.xmpp.xxx.xx" to="username_242e8112_de33@xmpp.xxx.xx/xxxxxxx"><query xmlns=""><reply/></query></iq>\000

We didn’t found any solution for this problem yet. Does someone elso encountered problems with this version of openfire?