0
我試圖創建一個基本的控制檯應用程序,以強調測試基於FluorineFx的Flash遠程服務器。使用FluorineFx作爲客戶端連接NetConnection時處理服務器端RtmpConnection.Invoke()
我可以連接罰款,但服務器的方法我打電話調用此客戶端的功能:
connection.Invoke("onServerDataPush", new string[] { "someParam", "anotherParam" });
我很努力找出我怎麼能揭露這種方法來連接。該NetConnection.Call()方法允許你在回調中通過,但這樣做的結果是始終爲空,然後將NetConnection調用失敗,出現以下錯誤:
Could not find a suitable method with name onServerDataPush
這裏是我的客戶端代碼:
class Program
{
private NetConnection _netConnection;
static void Main(string[] args)
{
var program = new Program();
program.Connect();
Console.ReadLine();
}
public void Connect()
{
_netConnection = new NetConnection();
_netConnection.ObjectEncoding = ObjectEncoding.AMF3;
_netConnection.OnConnect += netConnection_OnConnect;
_netConnection.NetStatus += netConnection_NetStatus;
_netConnection.Connect("rtmp://localhost:1935/MyApplication");
}
void netConnection_OnConnect(object sender, EventArgs e)
{
var responder = new Responder<object>(x =>
{
var test = x;
});
//The NetConnection object is connected now
_netConnection.Call("MyServerMethod", responder, "someParameter");
}
void netConnection_NetStatus(object sender, NetStatusEventArgs e)
{
string level = e.Info["level"] as string;
}
}