从服务器更新 Vaadin7 容器 - 是否使用服务器推送 [英] Vaadin7 Container Updates from Server - To use server push or not

查看:21
本文介绍了从服务器更新 Vaadin7 容器 - 是否使用服务器推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现 Vaadin 服务器推送,以便将服务器数据库上的更改推送给用户.例如,如果用户 A 保存到服务器 DB,则用户 B 应该会在其 UI 上自动看到更改.

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.

然而,Vaadin 书中指出:

However, the Vaadin book states that:

SQLContainer 不断地检查在连接的数据库表以检测外部添加或行的删除.默认情况下,假定表行数保持不变10 秒内有效.这个值可以从代码中改变;和SQLContainer 中的 setSizeValidMilliSeconds().

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?

SQLContainer 还会检查行更新吗?

Will the SQLContainer also check for row updates?

我认为服务器推送的原因是将数据更改推送给用户?

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

推荐答案

不,它只检查行数.您可以在 SQLContainer 的 size()updateCount() 方法的源代码中看到这一点.通过推送将每个数据库更改推送给用户并不是一种常见的做法,因为它不能很好地扩展.通过使用 Refresher 插件,您可以放置​​一个刷新按钮来更新容器的数据或定期轮询数据库的更改.(https://vaadin.com/directory#addon/refresher)

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)

这篇关于从服务器更新 Vaadin7 容器 - 是否使用服务器推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆