Taken from migration guide
Calls to client methods
==========================
To call methods from your Red5 application on the client, you will first
need
a reference to the current connection object::
import org.red5.server.api.IConnection;
import org.red5.server.api.Red5;
import org.red5.server.api.service.IServiceCapableConnection;
...
IConnection conn = Red5.getConnectionLocal();
If the connection implements the IServiceCapableConnection_ interface, it
supports calling methods on the other end::
if (conn instanceof IServiceCapableConnection) {
IServiceCapableConnection sc = (IServiceCapableConnection) conn;
sc.invoke("the_method", new Object[]{"One", 1});
}
If you need the result of the method call, you must provide a class that
implements the IPendingServiceCallback_ interface::
import org.red5.server.api.service.IPendingService;
import org.red5.server.api.service.IPendingServiceCallback;
class MyCallback implements IPendingServiceCallback {
public void resultReceived(IPendingServiceCall call) {
// Do something with "call.getResult()"
}
}
The method call looks now like this::
if (conn instanceof IServiceCapableConnection) {
IServiceCapableConnection sc = (IServiceCapableConnection) conn;
sc.invoke("the_method", new Object[]{"One", 1}, new MyCallback());
}
Of course you can implement this interface in your application and pass a
reference to the application instance.
Ciao
Matteo Lanzi
-----Messaggio originale-----
Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per
conto di [EMAIL PROTECTED]
Inviato: martedì 25 settembre 2007 9.59
A: Open Source Flash Mailing List
Oggetto: Re: [osflash] R: Rm: Client functions call from a Red5 server
Sorry, I was referring to I WAS talking about invoking client functions from
Red5....
África Belén Romero Fernández
Fynet Solutions
981 634 067
[EMAIL PROTECTED]
http://www.fynet.net
[EMAIL PROTECTED]
Enviado por: [EMAIL PROTECTED]
25/09/2007 09:48
Por favor, responda a Open Source Flash Mailing List
Para: Open Source Flash Mailing List <[email protected]>
cc:
Asunto: Re: [osflash] R: Rm: Client functions call from a
Red5 server
No, I wasn't talking about invoking client functions from Red5,
but I think that now I know how to do it : if the client class instance that
is kept in the connection
is named (i.e.) "FCAVPresence.stream", to invoke a method of this class you
must use :
RTMPConnection.invoke("FCAVPresence/stream/methodName",...)
which is the way that FCS/FMS uses internally.
There's other way : we can extend PendingCall class to compose our method in
this way
(with / separator) , and we could use the method
RTMPConnection.invoke(MyPendingCall call,...)
instead of invoke(String method, ....)
Thanks Matteo.
África Belén Romero Fernández
Fynet Solutions
981 634 067
[EMAIL PROTECTED]
http://www.fynet.net
"Matteo Lanzi" <[EMAIL PROTECTED]>
Enviado por: [EMAIL PROTECTED]
24/09/2007 19:21
Por favor, responda a Open Source Flash Mailing List
Para: "'Open Source Flash Mailing List'" <[email protected]>
cc:
Asunto: [osflash] R: Rm: Client functions call from a Red5
server
U can define a function insede the class that extends Apllication adapter
and than calli t from the flash client in the same way as FCS
Ciao
Matteo Lanzi
-----Messaggio originale-----
Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per
conto di [EMAIL PROTECTED]
Inviato: lunedì 24 settembre 2007 17.43
A: Open Source Flash Mailing List
Oggetto: [osflash] Rm: Client functions call from a Red5 server
Hello everybody :
I've one question about client functions call from a Red5 server.
Previously with FMS, the client classes instances were registered with a
name into the connection,
and , from the server using prefixes (= registered name), these instance
methods could be called,
without being defined in the connection.
Does anybody know any way to do this with Red5?
As I've seen, we can only invoke methods defined in the NetConnection.
Thanks in advance,
África Belén Romero Fernández
Fynet Solutions
981 634 067
[EMAIL PROTECTED]
http://www.fynet.net_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org