How to refresh a session on plone?

The documentation says it's possible to refresh the session using javascript, but i can't find how to do it. I don't want a timer refreshing the session, I need to really set a command to refresh the session if a specific event happens. How could I accomplish that?

The javascript solution is a part of plone.session. See its README for more info on how this works.
The short version is: activate this in the Add-ons control panel. It is available in standard Plone, but not activated by default.

I think the most important Python code is in the PAS plugin.

I'm aware of the addon that refreshes the session with each interaction on the screen, and i'm already using, whoever i need to activelly refresh the session by my own, using a if, in a specific situation, for a solution to my client. That's why i came here asking.

I've read the javascript file you sent, and couln't find where the code really refreshes the session, but only find the time checks and infos logged into the console.

Let's put it like that, i need to make my own session refresher using my own rules, does that make sense?

Enable the add-on and then look on the network tab of your browser. You should see a url like this being loaded:

http://localhost:8080/Plone/acl_users/session/refresh?session_refresh=true&type=css&minutes=5?version=2018-03-27%2000%3A00%3A00.000001

So the refresh method of the plugin gets called.

So in your javascript add a condition and call the same url. Would that work for your use case?

That would attend to me, as long as it imediatly refreshes the session and that i could call it again anytime. I'm gonna do some testes, thanks a lot.

I can't find that request you mentioned on my network tab, and the addon that refreshes the session seems not not working either even if it doens't show any errors, and the url you provided seems to be broken since it has two '?'. Also i don't know the method to call that request. How should I proceed?