Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Websocket closed "normally"
I am running Vaadin 7.7.6 on a Tomcat 8.5.8.
I have a UI annotated with @Push with Transport.WEBSOCKET.
My problem occurs after 900 seconds (15 minutes). What happens is that the websocket connection closes and the client log only shows:
"Websocket closed, reason: Normal closure; the connection successfully completed whatever purpose for which it was created."
"Websocket closed normally"
Very thankful for any hint on where to begin my troubleshooting.
Have you tried using WEBSOCKET_XHR as transport instead of WEBSOCKET? You could also try adding ?debug=push to your application URL to see if there's any more information to be had.
Sorry, I actually have WEBSOCKET_XHR.
I have debugging a little bit more now. I have two different UI's. I am tracking the heartbeats. The heartbeat of the working UI is reaching the service method of the VaadinServlet but the heartbeat of the non working UI is not reaching the VaadinServlet. When debugging into the tomcat container the request is lost somewhere before it reaches the VaadinServlet. But as I said, ONLY for one of the UI classes and they are configured the same (in relevant aspects)
I used the ?debug=push and noticed this difference between the two UIs
Wokring UI: "Communication method: Client to server: XHR, server to client: websocket"
Non working UI: "Communication method: Client to server: XHR, server to client: -"
This also appear in the client console:
Response didn't contain a server id. Please verify that the server is up-to-date and that the response data has not been modified in transmission."
I don't suppose you have a proxy / reverse proxy in place? Or a firewall that might be affecting the traffic?
No I don't. I guess that would have affect the other UI as well?
Not necessarily, you could be blocking a specific URL like /nonworkingappname/PUSH.
Do you have a web.xml? If not, you could try using that to explicitly set async-supported and pushmode.
That "Client to server: XHR, server to client: -" looks like how it would look if Push wasn't enabled.
Ok, you mean web.xml instead of annotations?
The woking ui is mapped to "application/" where as the non working ui is mapped to "application/permalink".
Are they still suppose to use the same mapping for PUSH?
Yeah, try web.xml instead of annotations.
<init-param> <param-name>pushmode</param-name> <param-value>automatic</param-value> <!-- or whichever you want --> </init-param> <async-supported>true</async-supported>
for each <servlet>.
I only have one servlet, mapped to "application/". Can that cause a problem?
Yeah, that's possible. Can you try creating a servlet for each UI instead?
That worked, thx. My problem now is that I map one servlet to /application and the other to /permalink and I also provide the different servlets with a UI via the init-param "ui". Each UI is annotated with @SpringUI(path = ""). It seems like the UIs aren't associated with the respective ui. When I start up, I get "No UIProvider has been added and there is no "UI" init parameter". When I instead annotate the permalink UI with @SpringUI(path = "/permalink") it works. But then I have to write localhost:8080/permalink/permalink to access that ui, i.e. first the servlet mapping and then the ui path. I want to be able to access the UIs via
localhost:8080/application and localhost:8080/permalink