|Cassius Rosenthal on 5 Sep 2007 15:17:53 -0000|
I've written several XUL apps that work that way: client-side code is bootstrapped on the first request to the web server, in an index file or whatnot. All subsequent http requests are xml or json.
Often, development for an app like this goes something like:
*) Make all or most of the application 'pages' in standard XUL/XML/HTML.
*) Move the navigation controllers to client-side, and simulate posts with 'save' buttons, etc.
*) Finally, move all other controllers to client-side, and use event observers to automate interactions with the server.
The end result is a mostly client-side MVC app where the M is on the server, and the VC is on the client. The Rails controller only coordinates sending the data to the client and handling sessions, and the Rails view only bootstraps the client-side code. The app will then feel like a regular desktop app, with responsiveness dependent on network lag.
The synchronization problem has for the most part been solved. What happens when you open the same document twice? Expected behavior is that your OS either brings the open document to the forefront, or prompts you to refresh the view if you return to the original when the copy has been changed. Using an encapsulated application in XUL, you can implement the former solution in the DOM. Otherwise, you can use onFocus to compare updated_at values, and prompt for the refresh.
Brian Donahue wrote: