EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
Expand all | Collapse all

Session Timeout and Logout Application

  • 1.  Session Timeout and Logout Application

    Posted Mon March 23, 2015 06:31 AM

    Hi,

    As part of a requirement in our application, we want our application to logout automatically if there is no activity for 30 minutes.

    Whereas we are not sure how we can check the inactivity time in EGL and execute any function without any action on front end.

    Any guidance is appreciated.

    Thanks

    JaikyBathija


  • 2.  Re: Session Timeout and Logout Application

    Posted Mon March 23, 2015 01:08 PM

    You can set a timer in your Main handler that counts down 30 minutes and then logout. This timer has to be reset to 30 minutes again every time there is activity in the application. The activity can be send to the Main handler by an Infobus event. In fact the Main handler can respond to every Infobus event that is send and reset the timer.

    Set a timer that count down:

    logoffTimerJob Job{runFunction = automaticLogoff};logoffTimerJob.schedule(1800000); // 30 minutes in miliseconds.

    Listen to any Infobus event that is send. This can be an Infobus event you sent specifically to reset the timer or an Infobus event that serves some other purpose but still is picked up by the Listener that resets the timer.

    InfoBus.subscribe("**", receiveResetTimer);function receiveResetTimer(msg String in, data any in)    logoffTimerJob.schedule(timeout);end

     

    Ortwin

    Ortwin


  • 3.  Re: Session Timeout and Logout Application

    Posted Tue March 24, 2015 02:29 AM

    Thanks Ortwin,

    This will be very helpful for us.

    JaikyBathija


  • 4.  Re: Session Timeout and Logout Application

    Posted Tue March 24, 2015 10:16 AM

    Lazy as we are .... we have built an 'automatic' session-timeout-mechanism.

    It's pretty much the same as Ortwin's example but we reset the timeout based on two events on document.body.

    This way we do not have to think about resetting the timeout programmatically in every function we build.

    Something like:

    timeoutJob Job{runFunction = logoff};document.body.onMouseDown ::= resetTimeout;document.body.onKeyDown ::= resetTimeout;private function onConstruction()    timeoutJob.schedule(30 * 60 * 1000);endprivate function resetTimeout(e Event in)    timeoutJob.schedule(30 * 60 * 1000);endprivate function logoff()    // Logoff actionsend

    Regards,

    Guus

    gweis


  • 5.  Re: Session Timeout and Logout Application

    Posted Thu March 26, 2015 10:54 AM

    Like Icon Like icon

    Ortwin