2 Replies Latest reply on Jun 23, 2009 7:54 AM by z_z_z_z

    blazeDS poll problem

    z_z_z_z

      hello, here is the question

      I have j2ee server, and flex client, i have configured blazeds and working remote objects and messaging from the client that is fine. Here is the problem

      how to make Client to poll for example at every 3 seconds to call some remoteObject's method for some kind of update or whatever, or something like chat client functionality with consnat checking for new data...

        • 1. Re: blazeDS poll problem
          sri harsha namala Level 2

          Hi,

               You can use Timer at Flex to Call Remote Object for every certain interval of Time ,You can use the following code

           

               <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleated()">
              <mx:Script>
                  <![CDATA[
                      import mx.controls.Alert;
                      private var timer:Timer;
                      private function creationCompleated():void
                      {
                          timer=new Timer(5000);
                          timer.addEventListener(TimerEvent.TIMER,callRemoteObject);
                          timer.start();
                      }
                      private function callRemoteObject(event:TimerEvent):void
                      {
                    //                Alert.show("TimerEvent Called");

                   //               call remote object here
                      }
                  ]]>
              </mx:Script>
          </mx:Application>

           

          But my Suggestion is you can use the Messaging  provided by BlazeDs,

          By using Messaging you can use ServerPush whenever any thing is modified in Backend just Push that data to the Client(Flex),Instead of polling for every certain interval of time.