[Red5] Getting a List of Users?
abogartz makaimedia.com
abogartz at makaimedia.com
Wed Oct 24 11:00:52 PDT 2007
Hi there, I've gotten Red 5 working, and so now I'm trying to delve into
the various functions.
I've copied over the following connect method:
private ClientManager clientMgr = new ClientManager("clientlist",
false);
public boolean connect(IConnection conn, IScope scope, Object[]
params) {
// Check if the user passed valid parameters.
if (params == null || params.length == 0) {
log.debug("Client didn't pass a username.");
// NOTE: "rejectClient" terminates the execution
of the current method!
rejectClient("No username passed.");
}
// Call original method of parent class.
if (!super.connect(conn, scope, params)) {
return false;
}
String username = params[0].toString();
String uid = conn.getClient().getId();
if (log.isDebugEnabled()) {
log.debug("Client \"" + username + "\" (" + uid
+ ") connected.");
}
// Register the user in the shared object.
clientMgr.addClient(scope, username, uid);
// Notify client about unique id.
ServiceUtils.invokeOnConnection(conn, "setClientID",
new Object[] { uid });
return true;
}
What I'd like to do is that whenever someone connects, everyone in the
room gets an updated list of users. How might I handle that? I assume
I iterate through some list, but I'm not sure. Any help would be
appreciated!
Thanks!
More information about the Red5
mailing list