Vaadin7 Container Updates from Server - To use server push or not

那年仲夏 提交于 2019-12-24 14:17:06

问题


I wanted to implement Vaadin Server push so that changes on the server DB are pushed to users. For example, if User A saves to the server DB, then User B should see the change automatically on his UI.

However, the Vaadin book states that:

The SQLContainer keeps continuously checking the amount of rows in the connected database table in order to detect external addition or removal of rows. By default, the table row count is assumed to remain valid for 10 seconds. This value can be altered from code; with setSizeValidMilliSeconds() in SQLContainer.

So does this mean that i dont need to implement server push for server db changes?

Will the SQLContainer also check for row updates?

I believed the reason for server push was to push data changes to users?


回答1:


No, it only checks the row count. You can see that at the source code of SQLContainer's size() and updateCount() methods. Pushing each DB change to users via push is not a common practice, because it does not scale well. You can put a refresh button to update the container's data or poll the DB for changes periodically, by using the Refresher addon. (https://vaadin.com/directory#addon/refresher)



来源:https://stackoverflow.com/questions/18440746/vaadin7-container-updates-from-server-to-use-server-push-or-not

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!