[Red5] can't invoke on client
ar iel
abracren at yahoo.com.ar
Mon Mar 9 07:29:57 PST 2009
thanks!!!
it works perfectly.
greeetings.
________________________________
De: Manuel Raña <info at vengava.com>
Para: red5 at osflash.org
Enviado: lunes 9 de marzo de 2009, 13:23:54
Asunto: Re: [Red5] can't invoke on client
Try replacing this:
function aaa(aa){...}
by:
nc.aaa = function(aa) {...}
2009/3/9 ar iel <abracren at yahoo.com.ar>
Hi,someone can tell me what's wrong with this code, I can call a function in the server but not in the client, I'm losing my mind!
package org.red5.demos.fitc;
import java.util.Iterator;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.Red5;
import org.red5.server.api.service.IPendingServiceCall;
import org.red5.server.api.service.IPendingServiceCallback;
import org.red5.server.api.service.IServiceCapableConnection;
import org.red5.server.api.stream.IBroadcastStream;
import org.red5.server.api.stream.IPlayItem;
import org.red5.server.api.stream.IPlaylistSubscriberStream;
import org.red5.server.api.stream.IStreamAwareScopeHandler;
import org.red5.server.api.stream.ISubscriberStream;
import org.red5.server.api.service.ServiceUtils;
public class Application extends ApplicationAdapter implements
IPendingServiceCallback, IStreamAwareScopeHandler {
public IScope appScope;
protected static Logger log = LoggerFactory.getLogger(Application.class);
/** {@inheritDoc} */
@Override
public boolean appStart(IScope scope) {
// init your handler here
appScope = scope;
return true;
}
/** {@inheritDoc} */
@Override
public boolean appConnect(IConnection conn, Object[] params) {
log.info("Client connected {} conn {}", new Object[]{conn.getClient().getId(), conn});
log.info("Setting stream id: {}", getClients().size()); // just a unique number
return true;
}
/** {@inheritDoc} */
@Override
public boolean appJoin(IClient client, IScope scope) {
log.info("Client joined app {}", client.getId());
// If you need the connecion object you can access it via.
return true;
}
public String callFun()
{
IConnection conn = Red5.getConnectionLocal();
if (conn instanceof IServiceCapableConnection) {
IServiceCapableConnection sc = (IServiceCapableConnection) conn;
sc.invoke("aaa", new Object[]{"One"});
return "pass";
} else{
return "nopass";
}
}
public void resultReceived(IPendingServiceCall call) {
log.info("Received result {} for {}", new Object[]{call.getResult(), call.getServiceMethodName()});
}
public void appDisconnect(IConnection conn) {
super.appDisconnect(conn);
}
}
and the actionscript code:
nc = new NetConnection();
nc.connect("rtmp://localhost/fitcDemo");
nc.onResult=function(obj){
trace(obj);
}
function aaa(aa){
trace(aa);
trace("aa");
}
nc.call("callFun",nc);
thanks for reading
Yahoo! Cocina
Recetas prácticas y comida saludable
http://ar.mujer.yahoo.com/cocina/
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
Yahoo! Cocina
Recetas prácticas y comida saludable
http://ar.mujer.yahoo.com/cocina/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20090309/5590b6ea/attachment-0001.html>
More information about the Red5
mailing list