So, one of the requirements we have is to be able to alter the content of a page given a users input, where that user is either another user entirely or the main user of the given session. The aim is to impart a collaborative aspect on a given page so that anyone on the page can view the collective changes that have been made to that page.
This has brought me around to thinking about AJAX in a different manner. Normally, AJAX is used to pull info from the server. The page (or component on the page) makes a request of the server, and the server sends the response to the page/component. However, what do you do when you need to reflect changes to your model in near real time?
Well, the thought that comes to my mind is that you move to a push model. In the push model, whenever the data model changes it pushes those changes out to the view. Now, this is totally doable with AJAX, it's just a different way of thinking about things. I think it's been termed reverse AJAX.
Of course, the poor man's way of doing a push model is to actually do a pull model with automated (instead of user-requested) pulls on a short interval. The downside to this is that it can result in a ton of network traffic at the very least. Another downside is that you don't have true data coherence. You're basically taking a guess as to when the data model has changed.
So, I'm now investigating ways in which I can use a push model. I've found two promising leads: CometD and Pushlets. I might still opt for the poor man's approach, at least for now, but both of these bear investigation. When I know more, I'll post it here.
If you're interested in a good article which outlines some of the ways of going about this, check out this article here.
No comments:
Post a Comment