开发者

Flex: client / server messaging question (RPC or socket ?)

I'm building a Flex application, which is going to perform many server requests (let's say, that almost all interactions require an update from server).

At the moment I'm using remote procedure calls for it. But I was wondering if using a socket would be better.

In other terms, is maybe better to keep the connection alive rather then performing many calls in sequence ?

For my demo app I only have 1 client. Is the number of 开发者_JAVA技巧clients connecting to the server a factor for this choice ?

thanks


If you use a socket (and practically building your own NIO server, maybe based on Apache MINA) it is possible to obtain a boost on performance but in my opinion you will have to invest a huge amount of work on it. I know some people using this approach but for a very particular application (a Flash game which was supposed to have zounds of users). They spend one month building it.

Another solution (if you plan to use sockets) is to use some products which are offering RTMP channels (LCDS, WebOrb) but they are not free and in my opinion is does not worth it if you plan to use them just for RPC calls over a socket.

For most of the cases the RPC approach based on POST should be good enough. The AMF serialization is quite compact (I wrote here a small benchmark and you can find another resources on web).

Also the Flash Player is sending your RPC request in one batch - for example if you call in your Flex code 3 methods one after another all of them are going to be grouped in only one POST call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜