After finding out a site with a fishtank where each fish notified the presence of some jabber user (now it’s a christmas tree) I thought it would be interesting to do the same with flash and add some more dynamism (e.g. using events, mood, …) to the fishes.
The rest of the story is here:
- So the first thing was to find a Flash library to do all the XMPP communication with ejabberd through BOSH. Rapidly I googled and all links pointed to XIFF. So far, so good.
- Some IDE to work with Flash in linux. Eclipse with Flex Builer to the rescue following this notes. Some java issues, but not more than 1 hour to have Flex “Hello world” application up and running.
- Let’s look at some XIFF examples … and what? there is no example nor even documentation … except for some 4 examples on this site: chat, roster, multiuser chat room and invitations.
- Test the examples with ejabberd and … failed!!! This was getting harder than expected. Let’s check the Flex traces what was wrong. No way. I was about to cry when I got to a site that recommended me to remove the distribution flashplugin package and install the Adobe’s one and … well it worked.
sudo apt-get remove flashplugin-nonfree
- With Flex trace now working I didn’t get too many answers, so I dug into the jabber packets with Wireshark and discovered the XMPP stream communication was closed unexpectedly. Time to google and see I needed to apply a patch to ejabberd to work with flash.
- At this point I was actually crying. What was supposed to be a couple of hours of fun, it was being a trip to hell!!! So, with tears in my eyes I installed Erlang R12B-5 following these steps. Downloaded ejabberd 2.0.2, applied the patch, unpacked it, run configure script, compiled and installed it. WHAT???
- I said ejabberd 2.0.2 and the patch I found was for 2.0.0. Full of tears I adapted the patch for ejabberd 2.0.2 and then applied the patch, unpacked it, run configure script, compiled and installed it.
- Voilá! Chat (first example) working with AS3.
- Roster (second example) failed with below AS3 exception.
Error: No class registered for interface 'mx.resources::IResourceManager'
- At this point I was looking how to express my level of depression with my jabber mood. Googling and googling finally I got to this post that recommended me to load the affected class at the very beginning of the application and so I did it including the following lines in my class constructor. It worked.
// http://www.igniterealtime.org/community/thread/34519 // Do what FlexModuleFactory does, only by hand. var resourceManagerImpl:Object = flash.system.ApplicationDomain.currentDomain.getDefinition("mx.resources::ResourceManagerImpl"); //mx.core.Singleton.registerClass("mx.resources::IResourceManager", Class(resourceManagerImpl)); Singleton.registerClass("mx.resources::IResourceManager", Class(resourceManagerImpl)); - Time to test multiuser chat room (third example). Press debug button and then what??? What the **ll is doing??? I knew I’d just entered to the world of pain. I was feeling the pain until I stumbled upon iaminlikewithyou and played balloono until 3 AM. This site was really cool and seemed that they were using XMPP for the game communication but not really sure.
- Multiuser chat room (round II). I read the example code and realized that I had to create a multiuser chat room and invite the user from an XMPP client (e.g. Pidgin) to work. That was not so difficult but the morale was already killed in the 5th step.
- Invitations (fourth example) was really easy probably at this stage I was trained to stand any suffering.
- No mood to create any fishtank nor christmas tree!!!
To sum up:
- XIFF
- no documentation
- no examples
- not work with AS3 out of the box
- support for chat, roster, MUC, invitations and BOSH although the latter I’ve not tested.
- ejabberd
not work with Flash out of the box.work with flash out of the box … with BOSH connection, not with XML socket connection (see Experiences with ejabberd and flash (III).
Hello,
This is not correct. ejabberd works with Flash out of the box. We use it very often of Flash customers project.
XIFF released version however is not XMPP compliant. You need to use SVN version so that it can work.
@Mickaël Rémond
Hi Mickaël,
Thanks for you comment. So, you mean XIFF’s SVN version works with ejabberd 2.0.2 without applying any patch to ejabberd? I think this is how I tried it but I will double check it.
Hi Mickaël,
I’ve tried to test the first example with ejabberd 2.0.2 without any patch and latest SVN XIFF version and it didn’t work. The first example I tested uses XMLSocket to connect ejabberd, so the first XML message sent to ejabberd is “policy-file-request” in order Flash can connect to the ejabberd server. As you said XIFF is not XMPP complaint, so I guess this is why ejabberd respond with an invalid-namespace error.
My question is how can XIFF and ejabberd work together? Using BOSH? If that’s correct, could you point me to an example?
thanks in advance.
[...] I was writing Flash and ejabberd experiences article, I thought to include all the detailed steps but I was afraid of repeating once more all [...]
[...] attempt 1 and attempt 2 trying to connect XIFF to ejabberd without applying any patch to ejabberd I finally [...]
@Mickaël Rémond
Thanks Mickaël,
You were right. There is no need to apply a patch to ejabberd to work with XIFF using BOSH, although I’ve not succeeded with XML sockets.
@keoko
Just wanted to make sure you get a mail for checking this webpage so that I may get some help from you on my issue posted on this page.
Regards,
Shubhra