at the moment i am using something like this - 
it works but i am new to red5 and i wonder if there is a easier way to
notify a single client from a remote service ...

thanks
eric

private IConnection getRemoteUserConnection(String otherUserId) {
                IConnection conn = null;
                IScope scope = Red5.getConnectionLocal().getScope();
                Set<IClient> roomClients = scope.getClients();
                IClient client = null;
                Iterator<IClient> it = roomClients.iterator();
                while (it.hasNext()) {
                        client = it.next();
                        if (client.getId().equals(otherUserId)) {
                                Set<IConnection> connset = 
client.getConnections();

                                Iterator<IConnection> itcon = 
connset.iterator();
                                while (itcon.hasNext()) {
                                        conn = itcon.next();
                                        if (conn instanceof 
IServiceCapableConnection) {
                                                break;
                                        }
                                }
                        }
                }
                return conn;
        }

        @Override
        public boolean acceptRequest(boolean bool, String otherUserId) {
                
                log.debug("Application.acceptRequest" + bool + otherUserId);
                IConnection conn = getRemoteUserConnection(otherUserId);

                
                if (conn != null) {
                        IServiceCapableConnection service = 
(IServiceCapableConnection) conn;
                        service.invoke((bool) ? "gameAccepted" : 
"gameNotAccepted");
                        return bool;
                } else {
                        return false;
                }
-- 
View this message in context: 
http://www.nabble.com/calling-client-side-methods-using-service.invoke%28%29-for-a-single-user---is-there-a-better-way-than-iteration-through-a-client-list-of-the-room-....-tf4256490.html#a12113532
Sent from the Red5 - English mailing list archive at Nabble.com.


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to