Vaadin 7.2+ Server Push activate/decativate dynamically?

Hey together,

I want to use the new Server Push possibility of Vaadin but I only want to activate it (for server load reasons) if a user is logged in.
I guess I could just use different UI’s for logged in and logged out users but I wonder if there is a possibility to just activat/deactivate pulling dynamically

Samuel

Samuel-

You can construct your project to push manually so that you have full control of the push capabilities.

Look at:
link

I use manual push in all of my projects, just in case later on down the line I have to distinguish between user push capabilities.

Regards,
Eric

Hey Eric,

thanks for your answer. But as far as I understand every Visitor to my website will either open a WebSocket or (fallback) have a long-polling request opened to my server as soon as he enters a UI with @Push annotation (no matter whether manual or automatic push(. I thought that this would have an unnecessary impact on the server load and therefore though about only enabling push once it is a logged in and known user.
Am I wrong with my assumption that default push will increase the server load unnecessarily?

Regards,
Samuel

You can turn push off in your UI.init() subclass and then turn it back on when they login. It is not clear exactly what is happening under the hood thoug with respect to your question.

To turn off, for example: getPushConfiguration().setPushMode(PushMode.DISABLED);

On our bigger production server, we had to turn off push because it was crashing the server (it was running out of resources, which we still have not tracked down – but it appears that file descriptors or threads are exhausted). We run many webapps, each a Vaadin app, in a single Tomcat instance though, so it’s probably not a typical web server setup.

Thank you for the information.
I think I will start with a different approach and try to include push at a later stage, also because there seem to be severe client issues with older browsers according to this thread:
https://vaadin.com/forum#!/thread/8232643