PHP Session Handling and Ext.Direct
i have a question on PHP Session Handling.
I have extended my Ext.Direct apllication (http://extjs.com/forum/showthread.php?t=69840) with a session handling on PHP backend side.
The initial PHP script setups the session:
After that all the UI stuff is loaded.
SessionControler :: init($initialParams)
Anytime later within the client a method is called that is provided via Ext.Direct. Then router.php (http://extjs.com/forum/showthread.php?t=68186) is called:
Now my question: What should i do, if the session could not be resumed (e.g. idle time out)? In this case it's not allowed to deliver any results. The client needs to be informed that the session is no longer valid. How can i do this? I dont't want to break the comunication between the Ext.Direct PHP backend and the Ext client.
if (false === SessionControler :: resume())
// Error handling
// this should alwasy be set but if its not, then execute api.php without outputting it
$api = new ExtDirect_API();
$router = new ExtDirect_Router($api);
Thanks in advance,
Session handling methadology with Ext.direct Questions
Hi Jean Marie,
Sorry to jump into your thread, but had just finished writing a post to the forum on this specific problem and thought it better to add my questions to yours than start a whole new post.
I'm just starting to work with Ext and am especially interested in using Ext.direct with an existing application backend.
I'm trying to understand the 'best' way to handle session state with AJAX queries as Ext does not seem to have any 'set' way to do this.
A base requirement would be the user not losing their 'position' or data view in the application.
My thoughts so far as as follows;
In a perfect world, when the user logs back in after the expired session dialog is displayed, the request would be automatically re-submitted.
- In server implementation of 'direct', before passing call to method, check session status
- If valid session, allow call to pass through
- If invalid session, and call is not to the registered 'login' method (whatever that is defined as in backend), return the correct 'type' of response (for form or normal direct request) with a standardized error type
- if the response contains matching error for matching query type, interrupt process and display the login dialog with whatever received message.
- EG 'Your session has expired. Please log on and re-submit your request'
- if the response contains error not matching the 'predefined' error for session issues, return data to calling method with no interruption
- if the response contains no errors, return the data to the calling method with no interruption
I'm interested to see if anyone has implemented something similar and can share, or if there are glaring holes in process/logic.