在 Mate 中,同时向服务器发送两个或多个请求?

发布于 2024-09-25 10:04:58 字数 161 浏览 1 评论 0原文

我正在使用 Mate 的 RemoteObjectInvoker 来调用基于 FluorineFX 的 API 中的方法。然而,所有请求似乎都是按顺序发送到服务器的。也就是说,如果我同时发送一组消息,则直到第一个消息返回后才会发送第二个消息。有办法改变这种行为吗?我不希望我的应用程序在处理长请求时没有响应。

I'm using Mate's RemoteObjectInvoker to call methods in my FluorineFX based API. However, all requests seem to be sent to the server sequentiality. That is, if I dispatch a group of messages at the same time, the 2nd one isn't sent until the first returns. Is there anyway to change this behavior? I don't want my app to be unresponsive while a long request is processing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溇涏 2024-10-02 10:04:58

此帖子将帮助您了解发生的情况(它讨论了 blazeds/ livecylce 但我假设 Fluorine 使用相同的方法)。简而言之,发生的事情是:
a)Flash 播放器将您的所有调用分组到一个 HTTP 帖子中。
b) 服务器(BlazeDs、Fluorine 等)收到请求并开始依次执行方法。

解决方案

a) 每个方法有一个 HTTP post,而不是一个包含所有 AMF 消息的 HTTP post。为此,您可以使用 HTTPChannel 而不是 AMFChannels(内部使用 flash.net.URLLoader 而不是 flash.net.NetConnection)。您将受到浏览器定义的最大并行连接数的限制。

b)只有一个HTTP post,但在服务器上实现一个聪明的解决方案(这会花费你大量的开发时间)。基本上,您可以编写自己的并行处理器并使用消息消费者/发布者,以便将方法的结果发送到客户端。

c) 在 https://bugs.adobe.com/ 上有类似于 a) 的解决方法jira/browse/BLZ-184 - 手动创建远程对象并在端点末尾附加一个随机 ID。

This thread will help you to understand what happens (it talks about blazeds/livecylce but I assume that Fluorine is using the same approach). In a few words what happens is:
a)Flash player is grouping all your calls in one HTTP post.
b)The server(BlazeDs,Fluorine etc) receives the request and starts to execute the methods serially, one after another.

Solutions

a)Have one HTTP post per method, instead of one HTTP post containing all the AMF messages. For that you can use HTTPChannel instead of AMFChannels (internally it is using flash.net.URLLoader instead of flash.net.NetConnection). You will be limited to the maximum number of parallel connection defined by your browser.

b)Have only one HTTP post but implement a clever solution on the server (it will cost you a lot of development time). Basically you can write your own parallel processor and use message consumers/publishers in order to send the result of your methods to the client.

c)There is a workaround similar to a) on https://bugs.adobe.com/jira/browse/BLZ-184 - create your remoteobject by hand and append a random id at the end of the endpoint.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文