0

Vaadin Framework 8 offers built-in support for Push technology as discussed in the manual.

We can specify any of three modes, one of which is PushMode.MANUAL, documented as:

Push is enabled. A bidirectional channel is established between the client and server and used to communicate state changes and RPC invocations. The client is not automatically updated if the server-side state is asynchronously changed; ui.push() must be explicitly called.

If the whole point of Push is to automatically update the client, why would we ever want to use this mode?

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154

1 Answers1

4

Both modes keep a communication channel open so that updates can be sent from the server to the client at any time, compared to PushMode.DISABLED that only can send updates to the client in the response to a request that the client has opened as a reaction to user activity.

The difference lies in when this capability is actually used. With PushMode.AUTOMATIC, updates are sent whenever the session is unlocked, i.e. after running pending ui.access() tasks that have been scheduled from a background thread.

No update is sent if nothing has changed, but checking for this situation still has some overhead. There might also be situations when lots of fine-grained ui.access() tasks are run in rapid succession, but it's not desirable to send them all as individual updates to the client.

The purpose of PushMode.MANUAL is to give the application developer control over when changes are actually sent by explicitly calling ui.push(). This makes it possible to better optimise resource consumption in in cases when the automatic mode would cause excessive pushing. This is quite rarely needed, but the possibility does still exist.

Leif Åstrand
  • 7,820
  • 13
  • 19