views:

32

answers:

2

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 proxy to the client, never done it before. Any help?

+1  A: 

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.

jondro
+1  A: 

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.
Amarghosh