简体   繁体   English

Vaadin Push在10(流量)中不起作用

[英]Vaadin Push not working in 10 (flow)

In Vaadin 8, I am able to asynchronously update a Grid with incoming websocket data using the access method of UI, which locks the thread and performs the updates, then pushes them without the client having to request it. 在Vaadin 8中,我能够使用UI的access方法使用传入的Websocket数据异步更新Grid ,该方法锁定线程并执行更新,然后将其推送而无需客户端请求。

access(() -> addMessage(message));

I am trying to use vaadin 10 now, and since the main class you start with doesn't extend UI, I am trying to do it like this: 我现在尝试使用vaadin 10,并且由于您开始使用的主类不会扩展UI,因此我尝试这样做:

UI.getCurrent().access((Command) () -> addTrade(message))

However it is not working, and you have to click somewhere on the page for the update to happen. 但是,它不起作用,您必须单击页面上的某个位置以进行更新。 I have the @Push annotation on the class, so I believe server push should work.. thank you so much guys! 我在类上有@Push注释,所以我认为服务器推送应该可以..非常感谢!

in my servlet: 在我的servlet中:

asyncSupported = true

have also tried this.getUI().get().access() , still not updating. 还尝试过this.getUI().get().access() ,但仍未更新。

This is most likely caused by https://github.com/vaadin/flow/issues/3256 that is currently being fixed. 这很可能是由目前正在修复的https://github.com/vaadin/flow/issues/3256引起的。

The tickets also suggests a workaround: grid.getElement().getNode().markAsDirty(); 票证还建议一种解决方法: grid.getElement().getNode().markAsDirty(); . If the workaround solves the issue, then it's very likely caused by that bug. 如果解决方法解决了问题,则很可能是由该错误引起的。 If not, then there's some other issue that would require further investigation. 如果没有,那么还有其他问题需要进一步调查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM