Ruby on rails 在actionscript和后端rails服务器之间的通信中,什么更有效:httpService还是Externalinterface调用?
现在我正在使用httpPostRequest与rails服务器通信。我想知道这是不是最好的方法。将外部接口调用与jquery post结合使用会更快吗?现在我正在做这样的事情:Ruby on rails 在actionscript和后端rails服务器之间的通信中,什么更有效:httpService还是Externalinterface调用?,ruby-on-rails,actionscript-3,Ruby On Rails,Actionscript 3,现在我正在使用httpPostRequest与rails服务器通信。我想知道这是不是最好的方法。将外部接口调用与jquery post结合使用会更快吗?现在我正在做这样的事情: var httpUploadRequest:HTTPService = new HTTPService(); httpUploadRequest.url = serverPostUrl; httpUploadRequest.method = "POST";
var httpUploadRequest:HTTPService = new HTTPService();
httpUploadRequest.url = serverPostUrl;
httpUploadRequest.method = "POST";
// set up post parameters
var parameters:Array = new Array();
parameters = postParameters;
httpUploadRequest.addEventListener("result", function(event:ResultEvent):void {
//success function call
});
httpUploadRequest.addEventListener("fault", function(event:FaultEvent):void {
//post fail function call
});
httpUploadRequest.send(parameters);
说到这里,actionscript和rails之间通信的最佳方式是什么:httpService、ExternalInterfaceCall还是其他方法?如果其他,请解释。
谢谢来自Flash的直接HTTP请求将比jQuery的外部接口更快。jQuery连接最终将执行与Flash相同类型的HTTP请求,但需要额外的中间步骤。此外,如果不小心,可能会在应用程序中创建不必要的暂停,因为外部接口调用是同步的
根据您的后端,您可能会发现使用Flash远程处理可以提高速度,但不一定。这实际上取决于您正在使用的服务器端活动的类型。这正是我想要的。谢谢