powered by Jive Software

One 2 one chat, public roster, xtensibility (LONG)

Hello all. I am VERY new to XIFF/XMPP, so please forgive my newbie-ness.

Here is the (very simple) project I am working on:

A public roster - all users online are automatically viewable

only one to one chat available.

users automatically logged in based on variables passed from PHP script.

Authentication is already taken care of before they get the option to chat. All that is necessary is the username.

The client does NOT need to be compatable with other XMPP clients outside of the system.

This is how I have solved it so far:

I have created 1000 test user accounts on the Jive Messenger server.

The flash-chat application is based closely on the ‘‘xmpp example’’ included in the XIFF 2 Beta package.

I have created a room on the server that all users are logged into automatically.

instead of groupMessage

sendMessage function modified like so:
function sendMessage(messageBody) {
     chatRoom.sendPrivateMessage(recipientNickname, messageBody);
     addToChatOutput(nick, messageBody);

to allow ONLY one to one chatting.

I have deleted the chatRoster and instead placed dynamic rosterButtons in the same place.

Here is my dynamic buttons function:

function rosterbuttons() {
     if (_level0.chatRoom.rosterItems[0].nickname.length>1) {
          for (rosteri=0; _level0.chatRoom.rosterItems[rosteri].nickname; rosteri++) {
               // this is code for the placement label and action of the first button
               // I remove +1 +2 and +3 just in case 2 or 3 people left the room at the same time.
               this.attachMovie("Button", "rosterButton"+rosteri, curDepth++);
               if (rosteri == 0) {
                    this["rosterButton"+rosteri].setSize(Stage.width/3, 25);
                    labelname = _level0.chatRoom.rosterItems[rosteri].nickname;
                    this["rosterButton"+rosteri].label = this.labelname;
                    this["rosterButton"+rosteri].onRelease = function() {
                         recipientNickname = this.label;
                    this["rosterButton0"]._x = chatOutputWindow._x+chatOutputWindow._width+margin;
                    this["rosterButton0"]._y = margin;
               if (rosteri>0) {
                    // create other buttons and place dynamically based on the position of the first
                    this["rosterButton"+rosteri].setSize(this["rosterButton0"].width, 25);
                    labelname = _level0.chatRoom.rosterItems[rosteri].nickname;
                    this["rosterButton"+rosteri].label = this.labelname;
                    this["rosterButton"+rosteri].onRelease = function() {
                         recipientNickname = this.label;
                    this["rosterButton"+rosteri]._x = chatOutputWindow._x+chatOutputWindow._width+margin;
                    this["rosterButton"+rosteri]._y = this["rosterButton"+(rosteri-1)]._y+rosterButton0._height;

Notice “recipientNickname” is equal to “_level0.chatRoom.rosterItems[rosteri].nickname”. There MUST be a more efficient way of getting this information. Any suggestions?

Now in eventHandler I have modified the presence case like so:

case “presence” :



Where updateroster is a movie that calls rosterbuttons(); at frame 20, then goes back to frame one and waits. The reason for this is that if I call rosterbuttons() directly from the presence event, the label data is not yet ready and the last button will remain missing. This creates a small time delay, but a small price to pay at the moment to make it work.

So my intent here is to share what little bit I have learned so far, and open up a dialogue on how to make it better. Specifically these are features I want to add:

I think the user authentication on my website can handle announcing presence for the roster. Users are automatically signed in when they load the chat module…

I would like to have a menu bar in a seperate flash movie on the HTML page that lists the one to one conversations.

Each button would respond to presence (ie go dark when offline, go yellow when busy or red when unavailable) and when clicked would display that one to one conversation.

Also maybe they could flash when a new message is recieved in that one to one conversation.


I would like to make this system available to 10,000 - 100,000 users. I have an idea that for every 10,000 users, there may only be 1,000 online at the same time chatting.

I imagine I could add another Jive Messenger server for every 10,000 users, linking them via the client. After all the presence only needs to be sent/recieved for the buttons that are visible, and the buttons that are visible should not exceet 10 at a time.

So let’'s say that we have 10 Jive Messenger servers. We only need to have realtime presence info from 10 users at a time, potentially from different servers.

Server name is stored with the user session info.

For each button we need a presence listener.

Any ideas about how this daisy-chain might be impelmented, and what the performance issues are?