Hi Leif,
Leif Wells wrote:
> I swear, if I could understand how to read the damn Java docs properly
> I'd be better off. As is, I've reviewed much of the API and I still have
> issues. (I guess I am better at following examples rather than JavaDocs).
>
> In our application I have to tell all the connected users that this
> person has joined when a new user joins.
>
> Is there a direct method of doing this?
> getAllConnections().invoke("newuserlogged", id); or something like that
> Or do I need to hold on to references of connections and loop through
> then to invoke something?
I'll add a utility class for stuff like this. Here are two sample
methods for you to use in the meantime:
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.service.IServiceCapableConnection;
/**
* Invoke a method on a given connection.
*
* @param conn
* @param method
* @param params
*/
public static void invokeOnClient(IConnection conn, String method,
Object[] params) {
if (conn instanceof IServiceCapableConnection)
((IServiceCapableConnection) conn).invoke(method, params);
}
/**
* Invoke a method on all connections to a given scope.
*
* @param scope
* @param method
* @param params
*/
public static void invokeOnAllClients(IScope scope, String method,
Object[] params) {
List<IConnection> connections = new ArrayList<IConnection>();
Iterator<IConnection> iter = scope.getConnections();
while (iter.hasNext())
connections.add(iter.next());
for (IConnection conn: connections)
invokeOnClient(conn, method, params);
}
Joachim
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org