To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
We have got a Vaadin 8 WebApp with many pages. And are using push with websockets. Can we use poll at the same time? We have a vaadin grid which needs to be updated every 30 seconds in case the data has changed and it would be nice to set a polling interval and use a polling listener. Also when the user leaves the page with the grid the updating should stop. Which would be the case with polling, wouldn't it? But with push an extra thread would have to be created that pushes every 30 seconds and how could that thread be stopped once the user leaves the page?
Yes, you can use polling with Push. The polling implementation is just a server RPC, the same mechanism that is used to e.g. communicate field values to the server. The downside is that you will create a lot more requests from the browser to the server. A background thread could be stopped e.g. on the detach method of the UI - that will be called once three heartbeats have been missed.