开发者

How to push information from a PHP proxy to a Flex application

So I have a PHP proxy that gets information from a website. Let's say the proxy gets the information from (www.example.com). It checks if the number of lines returned is the same as before, if not then there are more lines, it counts the difference then it need to push this information to the Flex client saying that it has new information, (x) more lines have been written.

I am not really sure how to do the push mechanism on the php proxy because I am not sure how to actually push from the p开发者_如何学Goroxy to the client, never done it before. Any help?


Normally, you cannot initiate a transfer from the server side. You can either

  • set up a timer in the Flex application that fires every 2-3 seconds and checks the php proxy for updates using a URLLoader
  • use sockets (XMLSocket) for direct data pushing - use of sockets needs the client to open some ports which might be blocked by their firewall.


You can't really push anything from the server to your flash application unless you have an open connection. So you can either request the number from the proxy it fetches the info and gives it back to the app, or open a socket connection which is available since AS3. The socket connection stays up until explicitly closed, but that seems an overkill just for sending some info.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜