FluorineFx.NET

Client RPC calls

Handling RPC calls in the Application Adapter

All methods added in application adapter subclasses can be called from client side with the NetConnection.call method.

For example the following server-side code:

public class Application : ApplicationAdapter
{
   public string Echo(string msg)
   {
      return "Echo: " + msg;
   }
}

can be invoked by using the following ActionScript snippet:

nc = new NetConnection();
nc.connect("rtmp://localhost/application");
nc.onResult = function(obj) {
    trace("The result is " + obj);
}
nc.call("Echo", nc, "Hello");

 

If the method is defined with an argument of type IConnection as implicit first parameter then the current connection is automatically added when a client calls the method.