Detecting web api log off and ServiceStack session end  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Detecting web api log off and ServiceStack session end

Postby SBarnes » Sat Mar 03, 2018 1:35 pm

Hi Mike

Further to the post below, would there be now or in fixing DEV-6510 a way to setup hooking into the logging off of the web api and/or the ServiceStack session end so that other functionality could fire at the same time?

What I am asking about if the Jiwa database was being used possibly with extra tables to hold some sort of session state information how could you delete it when the session ends or the user logs off?

https://forums.jiwa.com.au/viewtopic.php?f=32&t=912
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1621
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 176

Re: Detecting web api log off and ServiceStack session end

Postby Mike.Sheen » Sat Mar 03, 2018 5:17 pm

Hi Stuart,

I've looked into the session timeout and rediscovered why we never implemented it - it's not possible to detect a session timeout!

This response from the ServiceStack maintainer states:
There is no event you can catch and no callback is possible for Session Timeouts which happens when the Caching provider transparently expires the cache entries.


I'll explore as part of DEV-6510 how we can deal with this - at the very least when a user authenticates, we can insert into a table some information including session id and expiration date, and every request which extends the session we can update that expiration date - so we should be able to work out from that when a session has expired. I'd rather not have a polling routing in the api to look for expired sessions and try to log them off - but that's a fallback position if all else fails - I'll try to work something out.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Detecting web api log off and ServiceStack session end

Postby SBarnes » Sun Mar 04, 2018 6:21 am

Hi Mike,

Thanks for the update, I suppose if you go with the table solution one option would then be to have a scheduled plugin as part of the API to do the clean up by scanning the session table and at least setting the user to logged off and do the clean up.

One thing that would however be useful would be an event to allow some sort of functionality when the API is logged onto and logged off from, whilst I know there is the loggedon and loggedoff events on the manager, I don't believe however you can tell if its from the API at the moment.

Thanks.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1621
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 176

Re: Detecting web api log off and ServiceStack session end

Postby SBarnes » Sat May 19, 2018 10:50 am

For anyone who needs a work around to this topic issue https://forums.jiwa.com.au/viewtopic.php?f=32&t=912

The following scheduled in a batch file under windows should do the job, it must run with Admin privileges to work though.

Code: Select all
sc stop JiwaAPISelfHostedService.exe

ping -n 16 127.0.0.1 > NUL

sc start JiwaAPISelfHostedService.exe
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1621
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 176

Re: Detecting web api log off and ServiceStack session end  Topic is solved

Postby Mike.Sheen » Tue May 22, 2018 1:53 pm

Thanks for that, Stuart.

FYI I've implemented a solution in DEV-6510 - I can't provide a complete plugin implementing this because our current 07.01.01 REST API plugin has dependencies on unreleased code - but I did update the DEV issue with the code snippets to implement this - and these will work with the existing 07.01.00 REST API Plugin.

So, for the adventurous, copying and pasting the snippets from DEV-6510 into the 07.01.00 plugin will see this addressed.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Detecting web api log off and ServiceStack session end

Postby SBarnes » Wed May 23, 2018 8:32 am

Thanks Mike

any update on a release date for 07.01.01?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1621
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 176

Re: Detecting web api log off and ServiceStack session end

Postby Mike.Sheen » Fri May 25, 2018 9:41 pm

SBarnes wrote:Thanks Mike

any update on a release date for 07.01.01?


I'm gunning for a DEV build towards the end of next week - it'll be at least few weeks after that before a public release is ready.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757


Return to REST API

Who is online

Users browsing this forum: No registered users and 1 guest