XIFF GUI (AS3 XMPP Demo)

XIFF GUI
Click image to view demo (Right-click demo to view source)

I’ve been working on building a chat room using XMPP (Jabber) and the XIFF AS3 API.
As Mike Chambers mentioned back in August, unfortunately there’s not a lot of documentation or tutorials out there for getting up and running with this library.
If you do want to get started, hopefully this will help you out.

First things first, you’ll need an XMPP server running. I’ve setup Openfire which is an open source, cross-platform, easy to setup XMPP server.
Next you’ll need the actual XIFF library.
Once you have the server installed and setup and the library downloaded, you can follow along with Mike Chambers tutorial up above for establishing an initial connection using the XIFF library.
Now at this point, you’ve managed to connect to an XMPP / Jabber server, join a room, and send a message to the room. This was great when I was jumping in and just trying to figure out how to get started. After you get your head wrapped around this, you’ll probably ask yourself the same thing I asked myself… “sweet… but now what?”
At this point you’re kind of on your own… or at least I was. I searched and searched but couldn’t find much more than a couple of simple tutorials very similar to Mike’s.
The one exception to this was a demo that I found from Nick Velloff that included source.
The demo shows examples of connecting to an XMPP server, logging in, registering, adding buddies, removing buddies, displaying the logged in user’s roster (list of buddies), changing a buddy’s group, changing the logged in user’s presence, messaging your buddies, and creating a multi user chat room. Shew… what a God-send right?
Well, once you download the source code and try to get it running locally you’ll soon realize that its not the immediate help you were hoping for. This demo was released back in October of 2007 and since then the XIFF library has been overhauled quite significantly.
Trying to alter the demo’s source to fit the new code was not an immediately simple fix either.
So anyway, I decided to sit down last week and go through every line of the demo code and update it to work with the latest XIFF library.
I also groomed the code a bit to make it take advantage of the Flex layout engine, separate the connection logic from the view, and fix some things that weren’t completely working in Nick’s original.
One other important thing to note is that the source code of my demo includes the current XIFF library for two reasons: 1) In case the library changes again and I haven’t updated the demo, you’ll still be able to download a completely functioning sample, and 2) I had to make some minor tweaks to the library to remove the voids from the constructors and add clone and toString methods to all of the events. I have submitted bug reports for both of those issues and hopefully they will be fixed soon, but until then I made the tweaks myself.
If the team over at Jive Software does not want me to include the source I will remove it and then explain what needs to be tweaked.

Hopefully this demo will help you as much as it helped me, although I have to say rewriting it probably helped me learn XIFF a lot more than just downloading a completely working sample, so definitely take your time with it, there’s quite a lot under the hood.

To download the source, click on the image above to view the demo and then right-click on the demo to view and download the source.
Please note that my host is not setup with a working XMPP server so the demo is not functional above, you must download it and connect it to your own XMPP server to see it fully functioning.

As the XIFF library changes, I will try and keep this demo updated.

About the author

Mark

View all posts

24 Comments

  • You are indeed Heaven-sent. Thanks for the effort. It is much appreciated.

    You’re indeed right, when you say there just aren’t enough info about the XIFF library. I was beginning to wonder why the developers of such a library would put up a wonderful stuff like this and not have a decent documentation or API Reference for it.

  • Hey thanks for the example!

    I agree with XIFF documentation being scarce; if you currently develop with XIFF, be prepared to get cut by the cutting edge. But what the hell, its free.

    What tag/branch of XIFF is your example based from? I am using the trunk’s src directory which its ‘core’ package doesn’t reflect the one you used.

  • Hey myIP,

    I’m using the latest download (XIFF 3.0.0-beta1), but as mentioned above I did make a few minor modifications that I have submitted (and they have been accepted) as bugs.
    Other than the clone and toString methods on the events and the removal of the voids from the constructors, nothing else changed from the latest downloadable source.

  • thanks for this example,
    It is really very help ful to me.

    but when i run it in my computer it not send invitation or not directly open that chat box to another friend side.

  • I tried to use this flex application to connect to my own OpenFire server. It works okay; however, It shows up an error every time I connected to the server. This is the error message.
    Code: 500, Condition: Undefined condition, Message: Unknown error, Type: modify.

    The error occurs after I received a tag. Does any one experienced this error message?

  • Yes, I have the same problem , Code: 500, Condition: Undefined condition, Message: Unknown error, Type: modify.

    I don’t know why. Do someone have the solution?

  • Yes, I have the same problem , Code: 500, Condition: Undefined condition, Message: Unknown error, Type: modify.
    I don’t know why. Do someone have the solution?

  • I have a single problem, when I connect to server chat, after 6 or 7 minutes, the chat is disconnect from server and I don’t know why. Do someone have the solution?

  • When I load my roster, I can only others user status as “offline” although they are online.
    But I can see their status when one of them change their status.
    Can anybody help me?
    Thanks

  • Hello, I am from China, Thank you for the source code, which will help me to better research Xiff. I will always be concerned about your everything! Thank you!

  • Hi,

    Does any one have a Flash (AS3) project of the same? (Not Flex based) πŸ™
    I am new to this stuff so its difficult for me understand and convert the code to work with Flash.

    • hey man , can you post your mobile xiff based client code? i am a xiff flex lover ,but now i encount some problems. big thanks.

  • To elfather:
    You have to set on Openfire Server, go to Server-> Server Settings -> Client Connections Settings, set on Idle Connections Policy tab to Do not disconnect clients that are idle.
    I hope its help.

Leave a Reply

Your email address will not be published. Required fields are marked *