vaadin / collaboration-engine

The simplest way to build real-time collaboration into web apps
https://vaadin.com/collaboration
Other
3 stars 1 forks source link

Help the developer in case they forgot to enable @Push #43

Closed Legioth closed 3 years ago

Legioth commented 3 years ago

If you try to use Collaboration Engine without enabling @Push in Flow, then things will typically be broken in ways that are not obvious. This is a quite common mistake to do when trying out something simple and it can be quite difficult to debug.

There is already logic in ComponentConnectionContext::checkForPush that checks for this and logs a warning (in development mode), but this warning is easily ignored. In addition to logging a warning, the same logic could also enable push if it isn't enabled.

We should then also provide a way of configuring CE to not enable push in case the developer for some reason wants to e.g. use UI::setPollInterval instead. API for this could be in CollaborationEngineConfiguration, e.g. as configuration.setAutomaticallyActivatePush(false).