4 Replies Latest reply on Sep 13, 2009 9:41 PM by July Chen

    how to control the user state?online or not online?

    July Chen Level 1

      I'm a programmer from China,

      my project need to control the states of users,

      I use FLEX+JAVA+LCDS to build this project,

      RemoteObject is used to connect the java and flex,

      i need to notice the DataBase when the user login or  logout.

      So, when the client leave the application with an unpredictable action,just like a loss of electric power ````

      How can I deal with it????

      Servlet is not used in this project,so I think the session cannot help me```

        • 1. Re: how to control the user state?online or not online?
          _Natasha_ Level 4

          Hi,

          HTTP connection can be created only from client ot server. And no other way!

           

          So.. if you want to know is client online, send liveMessage from client with some periods. If don't get message - you loose client.

          1 person found this helpful
          • 2. Re: how to control the user state?online or not online?
            salem_b_a

            Last week, i've been working on something similar; I'm using BlazeDS instead of LCDS!

            when the user log in, i insert a line in my sql table called session (username, password, time, type)!!

            i keep the id of this session for every client, and then when he disconnect, i remove the corresponding line.

             

            This way i assume that every user disconnects properly, else if he only closes the browser for example i get a pending session!

            i discovered 2 variables on blazeDS similar to session with servlet called FlexClientCount and FlexSessionCount, and i think it should exist on LCDS cause he's the father of BlazeDS

             

            i tried to avoid pending session problem using javascript call to a flex function, but the onunload js function ends so quickly that flex cannot execute the update request! i told you that just to avoid waisting your time if you will try this way.

             

            i'll tell you if any progress

             

            Regards,

            Ben Afia Salem,

            salemba@live.fr

            1 person found this helpful
            • 3. Re: how to control the user state?online or not online?
              July Chen Level 1

              THANKS~~~

              Your answer inspires me!But another question is :

              how can the server receive the liveMessage with some periods?

              Code in server only has some RemoteObject class

              • 4. Re: how to control the user state?online or not online?
                July Chen Level 1

                Thank you very much!!

                using javascript call to a flex function,I think onbeforeunload could help,

                onunload works only after the browser closing..I think...

                 

                session can be usefull with servlet call.

                my project   is without consideration  of servlet.....

                so if session is used to findout online or not,

                user will be  kicked out every session time```