It depends on your application and how users interact with a page.
For instance, if your page is a static page and doesn't do any AJAX or Websockets then it's entirely likely that simply setting up a setTimeout() (documentation) function to redirect after X number of minutes (where X is your session timeout). The timer would start when the page loads. You could even include this in your layout.
// assumes you are using the default login controller and action
window.setTimeout(function() {
// this should poll the server and check to see if the session is valid
// if not then it should issue the redirect (below)
window.location.href='${createLink(controller: "login", action: "login")}'
}, (20*60*1000)); // 20 minutes
However, if your application uses AJAX or Websockets that becomes more complicated as users can stay on a single page and interact with it and with each interaction the timeout on the session (server side) is being reset. This would require you to manage resetting the timer on the client-side (the page they are on) each time you perform an action. Doing this in $.ajaxStart may work (documentation).
var sessionTimeout = ... // leaving this implementation out as it's described above.
$(document).ajaxStart(function() {
// in your click function, call clearTimeout
window.clearTimeout(sessionTimeout);
// then call setTimeout again to reset the timer
sessionTimeout = window.setTimeout(...);
});
Websockets are an entirely different beast, but the same concept as above would apply, just when data arrives.
Without knowing more details about your application it's hard to say which is the right choice, but those are basically the choices you have and these examples should set you on the right path.