I have a similar problem, mostly because I could not find a function in
the red5 documentation which allows retreival of users connected to an SO.
I work around this by using a client function attached to the SO, which
a client uses to announce himself to all other users.
When a client disconnects the server sends out a similar message:
Server App:
@Override
public void appLeave(IClient client, IScope scope) {
IConnection current = Red5.getConnectionLocal();
String connid = client.getId();
Iterator<IConnection> it = scope.getConnections();
while (it.hasNext()) {
IConnection conn = it.next();
if (conn instanceof IServiceCapableConnection) {
((IServiceCapableConnection)
conn).invoke("userQuit", new Object[]{connid});
log.debug("userQuit from "+connid+" to
"+conn);
}
}
Client App:
connection.userQuit = userQuit;
function userQuit(quitID:Number)
{
//chat('DEBUG: Received exit notification for ' + quitID + ". I am
"+connectID+".\n");
var listin = findUserId(quitID);
if (listin != -1)
{
chat("<i><b>" + userList.getItemAt(listin).label + hasleft +
"</b></i>\n");
userList.removeItemAt(listin);
if (quitID == lastpriv) pubpriv.label = publicchat;
}
}
The userlist is maintained as a flash list element. "findUserId" returns
the list ID for the server user ID ... There is some other app specific
stuff in there, but you get the message. ;)
The drawback is that every time a user quits it is send to all users
connected, no matter which SO, so it creates overhead. Plus it's always
nicer to have a definite status, rather than tracking changes client
side. But it works.
My biggest problem however is, that without a way to get users connected
to an SO on the server side it is a serious hassle to count users in a
chatroom. To do this a connecting user sends out an alive query on all
SOs and counts the replies ... dirty as can be. ;)
So, while the above may be of some help to you, I would also really
appreciate a way to get user infos about an SO on the server side.
Ashu Gupta wrote:
> Hi
>
> I am still unable to get through server side script i.e. java class
> which uses shared object to sync users.
> I am really uncomfortable with the server side java script as I am
> newbie to this red5 and flex 2.
>
> Any help would be highly appreciated espacially if the language is
> simple or starts from scratch so that a newbie can understand.
>
> Thanking You
> Abhishek
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org