2 Replies Latest reply on Jan 11, 2011 12:04 AM by Mogge 3000

    Flex and PHP socket experiences...

    Mogge 3000 Level 1

      Hi,

       

      What are your experiences from using PHP-sockets with Flex?

       

      I building an application where data gets changed frequently and all users benefit greatly from having the latest data. So it's key to show up to date data in the app.

       

      Obviously you could poll the server continously, say every 5 seconds but that just dont feel right...

       

      My plan is to use PHP sockets and push messages to each client whenever data has changed. The messages would contain ID of the updated record. I'll then let Flex use it's DataManagement (services) functionality that is already in place to grab that record again. This way each client will be updated in "real-time" and there will only be a poll when it's need and only for the specific record.

       

      Your turn, please let me know why this is not the best way to solve my challenge. Maybe it wont scale well with lets say 5000 connections open, or is that not a problem? Compared to 5000 polls every 5 seconds for all rows in a table.

       

      Thanks for educating me!

       

      //Morgan

        • 1. Re: Flex and PHP socket experiences...
          Claudiu Ursica Level 4

          What you need is probably long polling. Make a request server helds it and then

          send back the message only when it has an update. Then client knows it needs to

          poll for the update. Not sure how to implement with php did not try it.

          You are right about scaling. Poll scales better than push. The question is are

          you able to throw in more hardware when the solution does not scale good enough?

          On the other hand if you decide to go with poll I would only make calls on an

          simplified url something that returns a Boolean hasNewData or as small as

          possible. Depends on the data you need to check for updates: If more than have

          more flags ... If has new data is true you make a call for the update you need.

          That way you only exchange minimum data over the network.

           

           

          HTH,

          Claudiu

          1 person found this helpful
          • 2. Re: Flex and PHP socket experiences...
            Mogge 3000 Level 1

            Thanks for your input!

             

            I've had a look at PHP long polling and it seems a bit tough to implement it. Anyone out there with a succesful PHP long polling setup? I've done a fair amount of googling on the subject and found nothing interesting...

             

            Ok, so I guess PHP is not the best language for this kind of interactions. To bad I'm not a Java guru I'd just use BlazeDS or something like that.

             

            I'll probably try implement some kind of intelligent polling system where the frequency will depend on current the view, number of concurrent users and so on...