VaadinService.reinitializeSession with websocket push

I am trying to reinitialise the session when a user logs on but this doesn’t seem to work when push is enabled and using websockets.

The issue looks closely related to this defect

What appears to be happening is that the session is invalidated then when getSession(boolean create) is called on the AtmosphereRequest instead of creating a new session is returns the original invalidated session so an exception is thrown when the code tries to set the attributes on the session.

Changing to long polling instead of websockets seems to get round the issue but this feels like a step backwards from using websockets. Is there any work around to get VaadinService.reinitializeSession and websockets to work together?


Due to the fact that the session support with WebSocket is rather hacky (as WS as a protocol is fundamentally distinct from HTTP-related machinery), session reinit with it might be quite tricky to implement properly.

I would probably recommend doing authentication and session reinit in regular HTTP and enabling push only after that if possible.

Hi Johannes,

I think your suggestion of enabling push after authentication should be a viable approach. Thank you for your help.