Keeping sessions for ever and ever and ever

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Keeping sessions for ever and ever and ever

Bernat Romagosa
Hi list,

I'd like to get a gmail similar behaviour in my app, so that users connecting from the same computer are always brought to the same point they were on their last visit, unless they specifically log out.

Is there a way to achieve this without totally clogging the server?

Thanks!

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Nicolas Petton
Hi,

It is very possible, that's what we do in SmalltalkHub. The idea is to
remove all actions & application state from the session, but keep it
alive and keep the user informations. We do it by overriding
ILSession>>expire in our subclass of ILSession:

MySession>>expire
    "Don't logout users"
        self user
                ifNil: [super expire]
                ifNotNil: [self releaseState]

MySession>>releaseState
        self
                clearActionRegistry;
                clearStateRegistries.
        applications := nil

You may have to rebuild the application state from the url, depending on
your needs.

Cheers,
Nico

Le jeudi 16 juin 2011 à 16:13 +0200, Bernat Romagosa a écrit :

> Hi list,
>
>
> I'd like to get a gmail similar behaviour in my app, so that users
> connecting from the same computer are always brought to the same point
> they were on their last visit, unless they specifically log out.
>
>
> Is there a way to achieve this without totally clogging the server?
>
>
> Thanks!
>
>
> --
> Bernat Romagosa.

--
Nicolas Petton
http://www.nicolas-petton.fr

Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Bernat Romagosa
Thanks Nico, it works.

Could it be this also fixed the "receiver of session is nil" problem by chance? I think I'm not having it anymore :)

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

thiago_sl
Hi list.
Bernat, i think it not  fixed the "receiver of session is nil", i
tried the code.



On 20 jun, 05:17, Bernat Romagosa <[hidden email]>
wrote:
> Thanks Nico, it works.
>
> Could it be this also fixed the  problem by
> chance? I think I'm not having it anymore :)
>
> --
> Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Bernat Romagosa
Hmm that's funny, I think it did fix it in my case, I've just come back from lunch, clicked around in my app and got redirected as I should, and the session was not lost :)

Here's my ILSession overrides:

onExpire 
       self user: nil

expire
       self user
               ifNil: [super expire]
               ifNotNil: [self releaseState]

releaseState
       self
               clearActionRegistry;
               clearStateRegistries.
       applications := nil

I kept the rest of the methods intact.

Cheers,

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

thiago_sl
Hi Bernat!
Do you have an anchor with an action to logout your application?
Is where the error happens.

I have an anchor in MyILApplication class, wich calls  'self session
logout'

MySession >> logout.
   self expire

Thiago.


On 20 jun, 09:55, Bernat Romagosa <[hidden email]>
wrote:

> Hmm that's funny, I think it did fix it in my case, I've just come back from
> lunch, clicked around in my app and got redirected as I should, and the
> session was not lost :)
>
> Here's my ILSession overrides:
>
> onExpire
>        self user: nil
>
> expire
>        self user
>                ifNil: [super expire]
>                ifNotNil: [self releaseState]
>
> releaseState
>        self
>                clearActionRegistry;
>                clearStateRegistries.
>        applications := nil
>
> I kept the rest of the methods intact.
>
> Cheers,
>
> --
> Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Stefan Schmiedl
In reply to this post by Bernat Romagosa
On Mon, 20 Jun 2011 10:17:12 +0200
Bernat Romagosa <[hidden email]> wrote:

> Thanks Nico, it works.

"What works?" he cried out, silently suffering the same problem,
but being too busy with other emergencies to attempt a fix.

I can't see Nico's response on my box here and a fix would
come in _very_ handy :-)

s.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Bernat Romagosa
Hi Thiago,

My logout method just goes:

MySession >> logout
self user: nil.
self redirect.

So the session can only expire "naturally", when it times out.

I think I can confirm it fixed the "receiver of session is nil" problem for good, I just tried to access the page after like 3 or 4 hours and it worked alright!

==========

Hi Stefan,

The World can save you ;)

Here's Nico's reply: <a href="http://forum.world.st/Keeping-sessions-for-ever-and-ever-and-ever-tt3602599.html#a3610155#none">http://forum.world.st/Keeping-sessions-for-ever-and-ever-and-ever-tt3602599.html#a3610155#none

Cheers!

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

thiago_sl
Hi Bernat,
I change my logout code, like you say, and it works!
But will be the session really invalidated (??).
Thank you very much for your help.

Cheers,
Thiago da Silva Lino

On 20 jun, 15:44, Bernat Romagosa <[hidden email]>
wrote:

> Hi Thiago,
>
> My logout method just goes:
>
> MySession >> logout
> self user: nil.
> self redirect.
>
> So the session can only expire "naturally", when it times out.
>
> I think I can confirm it fixed the "receiver of session is nil" problem for
> good, I just tried to access the page after like 3 or 4 hours and it worked
> alright!
>
> ==========
>
> Hi Stefan,
>
> The World can save you ;)
>
> Here's Nico's reply:http://forum.world.st/Keeping-sessions-for-ever-and-ever-and-ever-tt3...
>
> Cheers!
>
> --
> Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Bernat Romagosa
Hi Thiago,

It will, but only when it expires naturally, as the expire method checks whether the user is nil or not, and if it is, super expire is called.

I don't think this can pose a problem, if the user logs in again before the session expired naturally, then some of the session's data will have been kept and won't have to be rebuilt. Otherwise, the application will just behave as usually.

Anyways, I guess you could always send releaseState within the same logout method and avoid keeping unnecessary data around :)

Cheers,

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Nicolas Petton
Yes, but it still needs a proper fix.

Can you confirm that the issue is still in the development version? You
can get it from http://www.squeaksource.com/IliadDev

I'm using this version with Pharo and I never saw this issue.

Cheers,
Nico

Le lundi 20 juin 2011 à 22:05 +0200, Bernat Romagosa a écrit :

> Hi Thiago,
>
>
> It will, but only when it expires naturally, as the expire method
> checks whether the user is nil or not, and if it is, super expire is
> called.
>
>
> I don't think this can pose a problem, if the user logs in again
> before the session expired naturally, then some of the session's data
> will have been kept and won't have to be rebuilt. Otherwise, the
> application will just behave as usually.
>
>
> Anyways, I guess you could always send releaseState within the same
> logout method and avoid keeping unnecessary data around :)
>
>
> Cheers,
>
> --
> Bernat Romagosa.
>

--
Nicolas Petton
http://www.nicolas-petton.fr

Reply | Threaded
Open this post in threaded view
|

Re: Keeping sessions for ever and ever and ever

Bernat Romagosa
Sure, I will check it this afternoon.

Cheers,

2011/6/20 Nicolas Petton <[hidden email]>
Yes, but it still needs a proper fix.

Can you confirm that the issue is still in the development version? You
can get it from http://www.squeaksource.com/IliadDev

I'm using this version with Pharo and I never saw this issue.

Cheers,
Nico

Le lundi 20 juin 2011 à 22:05 +0200, Bernat Romagosa a écrit :
> Hi Thiago,
>
>
> It will, but only when it expires naturally, as the expire method
> checks whether the user is nil or not, and if it is, super expire is
> called.
>
>
> I don't think this can pose a problem, if the user logs in again
> before the session expired naturally, then some of the session's data
> will have been kept and won't have to be rebuilt. Otherwise, the
> application will just behave as usually.
>
>
> Anyways, I guess you could always send releaseState within the same
> logout method and avoid keeping unnecessary data around :)
>
>
> Cheers,
>
> --
> Bernat Romagosa.
>

--
Nicolas Petton
http://www.nicolas-petton.fr




--
Bernat Romagosa.