chrisburke.io
chrisburke.io

Reputation: 1507

Updating Grails VIEW on domain contents change

Similar Question: Grails: update view on data change

I would like to update a grails view when the data in the database relating to the domain is changed. I understand that AJAX seems to be the best way of doing such a task however it seems that requires I either click a link, or enter some text.

Would the best method be polling the domain object to see if the data has changed every x seconds, or can that lead to issues?

Perhaps if I can re-render a partial view by inserting the respective code in the controllers save/update actions?

The final result should be something similar to how Facebook have notification alerts at the bottom left of the screen. When somebody else changes data that is related to you, you receive an alert. My system requires something similar.

Upvotes: 0

Views: 463

Answers (1)

Eric Turner
Eric Turner

Reputation: 1824

You could poll in the client, though that has scaling and performance implications. Consider some kind of server push technology (http://en.m.wikipedia.org/wiki/Push_technology). I'm considering using Atmosphere for this.

Edit: check out this article http://codeyeti.com/posts/ajax-push-in-grails-using-the-atmosphere-plugin/

Upvotes: 2

Related Questions