I'm using Laravel 4 for building my one-page app and I need to implement a session timeout for the user to be redirected as soon as it is detected, I've been trying to check the $_SESSION/Session::exists() array through some polling requests but everytime I hit a route the session is refreshed.
How can I implement polling for session info on Laravel effectively? Do I need to do something more complicated like keeping an open connection (Websockets/Long pooling)?
I feel like this should be an out-of-the-box feature but strangely no-one seems to implement it, is it because most of the implementations are page-to-page instead of one-page + ajax?
That's a funny problem and you should use a middleware for that. If you're in laravel 4.1 or above laravel uses StackPHP
Check this link from fideloper, it might be useful.
Just set/update session variable(defined by you) in the middleware and create route that doesn't use the middleware in your API to query that variable.