[Red5] Maintain list of members in a chat room

oke _ loqi901 at yahoo.com
Tue Nov 13 14:06:42 PST 2007


Yes, this is a java Vector object (though I could have used any Collections object ), and it is *stored in* a shared object on the Red5 server - it's not the SO itself.
You can use the SO to store many different objects - you simply store and retrieve them as "attributes" of the SO. (See code snippet below:)

/**
 *  this method appends a user's name to the client-side username 
 *  list object on each connected browser
 */
public synchronized void updateClientLists(String szUserName)
{
        IConnection current = Red5.getConnectionLocal();
        IScope myScope = current.getScope();

        ISharedObject mySO = getSharedObject(myScope, "roomSO");

        // now update roomlist shared obj...
        Vector<String> usernameVect = (Vector<String>)mySO.getAttribute("UsrList");
        usernameVect.addElement(szUserName);

        // finally, update the SO
       mySO.setAttribute("UsrList", usernameVect);
        :
        :
        : 
        //  client-side update code goes here (see previous email postings)


Sebastien <virtual.user at gmail.com> wrote: 
Ok I made my homework and setup my development environment and read a lot of tutorials for java and red5 ;)


I have small question about the "( 'usernameVect' is a Vector representation of the shared object containing the names):" 
What do you mean with "Vector representation of the share object?"  The usernameVect is the name of my SO ?

Thanks

Sebas




 _______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org


       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5_osflash.org/attachments/20071113/b3c0f388/attachment.html 


More information about the Red5 mailing list