Submitted by Syd Nicholson on Thu, 01/12/2012 - 00:00
Forums

Happy New Year Niels,

Can I pick your brains on a niggly little problem that probably isn't significant.

This is the background. ---  Users log on to the system in the browser, then "expect" to stay logged on forever. They leave their PCs switched on all the time and never log off. Bad practice, I know.

The problem - their session goes away after 24hrs, then, when they try to do something - they are rejected because they are not logged on to the server.

My question -- I would like to automatically refresh the logged on status in the browser if, and only if,  there has been no activity for (say) 24hrs. I have some ideas, but,  I was wondering if there is a feature in the browser that knows when it was last used. I only want to refresh the browser if it has not been used for a specific period of time, I don't want a refresh whilst the user is using it - this would be undesirable.

I also don't want to refresh too frequently - the polling to the server will prevent the session from timing out and will keep the user logged in forever.

I could implement some form of timer, a counter that is reset at every transaction, and a time period of 24hrs and 1 minute. This seems crude, it would use up processor cycles, and I need to add the reset of the counter into every process. There are a lot of processes - several hundred - possibly even over a thousand. Not ideal.

Of course - this "feature" might never be important if I could educate the users. Problem is - they just expect it to work. The are not interested in what they call "excuses", security, technical limitations, or other similar minor issues.

Best regards,

Syd

Niels Liisberg

Thu, 01/12/2012 - 00:00

Hi Syd;

And Happy New Year to you too.

I will suggest you make ajax request to a tiny RPG program based the browser timer- lets say each hour. The call to the RPG program ensures that the server job running the session will not timeout. And the browser timer will ensure that you don't keep jobs for connections which no longer exist.

Assuming that you are using ExtJs - Something like this:

--------------------------------------------------------------------------------
<html>
<head>
<title>Ping test</title>
  <script type="text/javascript" src="/system/components/ext-2/adapter/ext/ext-base.js"></script>
  <script type="text/javascript" src="/system/components/ext-2/ext-all.js"></script>
</head>

<script type="text/javascript">

Ext.ns('ping');

ping.setTimer = function () {
  var t=setTimeout("ping.doPing()",3000);
}

ping.doPing = function () {
  Ext.Ajax.request({
    url:'ping.aspx',
    success: function ( response, request ) {
      console.log("ping ok");
      ping.setTimer();
    }
  });
}

ping.setTimer();

</script>
</head>

<body>
</body>
</html>
--------------------------------------------------------------------------------

And a small RPG IceBreak Program PING.ASPX like this:

<%
/free
//' ------------------------------------------------------------------------------------
//' Main line
//' ------------------------------------------------------------------------------------
  *INLR = *ON;
%> 
--------------------------------------------------------------------------------

When you start your firebug, you will see something like the following in your console. Note this test program is set to 3000 – this is 3 seconds. As mentioned, I'll suggest you do it once an hour (see the attached screenshot)

Screenshot of Script

Best regards,

Niels Liisberg

Syd Nicholson

Mon, 01/16/2012 - 00:00

Thanks Niels;

That is what I thought I would have to do. I already have a time that updates a clock in the browser every second.

I was kind of hoping there would be something in the browser that would know when the last transaction was made, so that unused sessions could be automatically "signed off" and the user menu updated. The problem at the moment is that the session times out on the server - but the browser still thinks the session is active. I suppose keeping the session active with a "ping" is the next best option.

I have another question for you - this time about IceCap:

The screen print allows you to see what I mean:

Screenshot Output Queues

A GUI work with Output Queues. In this application the user can only see a limited list of queues. This application has been implemented using the system APIs and not IceCap, although - we could do it all with IceCap. So this where my questions are.

1. I presume it would be best to have 3 different Virtual Terminal sessions for the three frames on the display?
2. Is it safe to leave the virtual terminal open on the server between user requests, or is it best to close the terminal at each request.

Also:
3. You will see the drop down menu has a display option. I tried to implement this using BlueSeries to convert the spool file to PDF. This was not successful, especially for the larger spool files. It either does not work, it takes too long to display, or it is shown rotated through 90 degrees.

I should be able to use IceCap to perform a DSPSPLF and send the output to the display from a vtTerminal. In its simplest form,  send all the text and attempt to format it in the browser. This will run into problems with large spool files.

What would be the best way to achieve the reading of the "subfile" for output to the browser?

Rising to challenge - a providing a better solution. Sending the output a page at a time to the browser.

Regards,

Syd

Hi Syd;

In this particular case I think I would use a rather old school but efficient trick; CPYSPLF. This is actually the way IceBreak presents compiler post list!

If you combine the CPYSPLF to a database file in QTEMP and use the <pre> formatting tag you can come rather close to a usefull result.

Try this: 

1: create a small RPG program containing syntax error like 

<%
/free
   John = *ON;
%>

2: save it to the IFS
3: compile it by the JIS.  Simply referring to it from the URL
4: You will se the "blue" error report
5: Now press "show page source"

Screenshot

Best regards,

Niels Liisberg