Project

General

Profile

Actions

Support #3617

closed

Signal from dead session causes reload, want to avoid that

Added by Eivind Midtgård over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
10/02/2014
Due date:
% Done:

0%

Estimated time:

Description

I have an app (page) with a logoff button. If the user presses the button, I do a redirect to a static page and a quit. This makes the session be removed and my app object be deleted, which is what I want.

I also have a timer which will emit if the user doesn't log off within a certain time. This is in case the user walks away. If that happens, I post the action to be taken in the session context (since the signal will be received on a different thread, as this is not a WTimer):

    // In the application object handler for a timeout signal from a non-Wt::WTimer
    Wt::WSession::instance()->post(sessionId(), 
        [=]()
    {
        m_login.logout();
        redirect("/loggedout");
        quit();
    });

What happens is that a new session and a new app object are created. I need to avoid that. The log says "Wt: signal from dead session, sending reload."

I believe this is because the web page in the browser sends a 'keep alive' signal, which Wt intercepts and finds comes from a dead session. If necessary and possible I could turn off those keep alives when the timer signal is received. But how do I do that?

Is there a way to solve my problem: When the user logs out, or the timer forces logout, then I want to show a static page.

Regards,

Eivind


Files

quit.cpp (908 Bytes) quit.cpp Koen Deforche, 10/16/2014 07:06 PM
Actions #1

Updated by Koen Deforche over 9 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
  • Target version changed from 3.3.3 to 3.3.4
Actions #2

Updated by Koen Deforche over 9 years ago

Hey,

I had to make one more change so that you could actually quit() from within a posted event, but the attached test case now works.

Note that you need to enable server push if you want to manipulate the UI from within a server-side event.

Regards,

koen

Actions #3

Updated by Eivind Midtgård over 9 years ago

Hi Koen,

Thanks! I changed your test case to timeout every 10 seconds and I commented out the triggerUpdate, and then my problem immediately appeared. So the problem was that I didn't do triggerUpdate.

Regards,

Eivind

Actions #4

Updated by Koen Deforche over 9 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF