I switched from tomcat to jetty. Everything but the jetty idleTimeout is working great. I have configured the timeout after the jetty-specific instructions here: WebSocket API :: Spring Framework but all EndpointSubscriptions still times out after just 30 secs. Are Hilla doing something special with the sockets? Anyone having any idea of what to alter? I am out of ideas.
The latest Jetty versions have a default timeout of 30 seconds for websockets, but Atmosphere can be configured to use a different timeout by setting the org.atmosphere.websocket.maxIdleTime
parameter; see Push websocket disconnects repeatedly and alerts user · Issue #17215 · vaadin/flow · GitHub).
This has been fixed in Flow 24.3 (Enable Atmosphere heartbeat by tepi · Pull Request #17845 · vaadin/flow · GitHub), but maybe not in Hilla.
It could be good to create a ticket on Hilla repository: Sign in to GitHub · GitHub
Workaround: add a bean post processor to set the timeout value
@Bean
BeanPostProcessor setPushWebsocketTimeout() {
return new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof ServletRegistrationBean<?> registrationBean && "atmosphereServlet".equals(beanName)) {
registrationBean.addInitParameter(ApplicationConfig.WEBSOCKET_IDLETIME,
String.valueOf(300000));
}
return bean;
}
};
}
It worked! You are awesome Marco
Let us now just hope there are a performance gain or something so its worth the switch
/J
Too bad jetty aint working in production though Going back to tomcat to have a stable prod-site.
META-INF/resources/index.html not found in /home/user/project/project-production.jar!/BOOT-INF/lib/line-awesome-1.1.0.jar from FileNotFoundException
BTW, which Vaadin and Spring Boot version are you using?
I remember Jetty 12 had some issues with resource handling, that should have been fixed in 12.0.8
Take a look at this comment Spring boot 3.2 and Vaadin 24.3.x Connection lost in jar after startup with jetty - maven/intelli work fine · Issue #19041 · vaadin/flow · GitHub
Hilla 2.5.0 and Spring Boot 3.2.4 which depends on Vaadin 24.3.0 and Jetty 12.0.3.
There was an exception when I tried Hilla 2.5.7, which I do not remember what, but I reverted back to 2.5.0 since I didnt have the time to investigate further. But I have now. So I try to upgrade.
Upgraded to Hilla 2.5.7, but that doesnt work in production due to it pulling in Vite 5.1.1 which contains this bug: __vite__mapDeps
is not defined · Issue #15702 · vitejs/vite (github.com)
So I upgraded to 24.4.0.beta3 and now the production server runs smoothly with jetty and websockets