Vaadin Touchkit Heartbeat always reset to 60 seconds.


I have set up a Vaadin touckit application ( Tomcat 8, Vaadin 7.6.4, Touchkit V4.1.0.rc1 )
I configured the heartbeat interval in the following annotation

@VaadinServletConfiguration(productionMode = false, ui = myTouchKitUI.class, heartbeatInterval=-1, closeIdleSessions=true)

The ?Debug output from the Chrome browser seems to recognise the heartbeat interval at -1 ( which I understand as disabled)

02ms Vaadin application servlet version: 7.6.4

112ms Setting hearbeat interval to -1sec.

115ms JSON parsing took 0.195ms
117ms Handling message from server
118ms* Handling resources from server
118ms* Handling type inheritance map from server
119ms Handling type mappings from server

The General information tab in the debug windows is as follows showing the heartbeat disabled.

Client engine version 7.6.4
Server engine version 7.6.4
Theme version 0.0.0.unversioned-development-build
Widget set com.SyberNet.myApp.gwt.myAppWidgetSet
Theme paytheme
Communication method Client to server: XHR, server to client: -

Heartbeat Disabled

However, later on in the debug window I get this message

143ms Dispatching: APP_STARTING → APP_STARTED flags=false true false
144ms Network Back ONLINE (APP_STARTED)

147ms Setting hearbeat interval to 60sec.

And if I look at the tomcat logs the heartbeats are coming in every 60 seconds. - - [22/Mar/2016:12:01:42 +0000]
“POST /myApp-1.0.0/HEARTBEAT/?v-uiId=1 HTTP/1.1” 200 - - - [22/Mar/2016:12:02:42 +0000]
“POST /myApp-1.0.0/HEARTBEAT/?v-uiId=1 HTTP/1.1” 200 - - - [22/Mar/2016:12:03:42 +0000]
“POST /myApp-1.0.0/HEARTBEAT/?v-uiId=1 HTTP/1.1” 200 - - - [22/Mar/2016:12:04:42 +0000]
“POST /myApp-1.0.0/HEARTBEAT/?v-uiId=1 HTTP/1.1” 410 1064

After the first three, the VaadinSession is removed, however, the client continues to send heartbeats but now every 10 seconds and the tomcat server returns a 410 response. - - [22/Mar/2016:12:04:42 +0000]
“POST /myApp-1.0.0/HEARTBEAT/?v-uiId=1 HTTP/1.1” 410 1064 - - [22/Mar/2016:12:04:52 +0000]
“POST /myApp-1.0.0/HEARTBEAT/?v-uiId=1 HTTP/1.1” 410 1064 - - [22/Mar/2016:12:05:02 +0000]
“POST /myApp-1.0.0/HEARTBEAT/?v-uiId=1 HTTP/1.1” 410 1064

I have looked in the documentation and don’t see why the heartbeat interval is reset to 60sec.
Also what mechanism in the application is triggering the 10 second heartbeats once the VaadinSession has been removed.

Thanks for any help,

I found an answer myself.

OfflineModeEnabled is true by default on TouckkitServlet based applications.
You must set @OfflineModeEnabled(false) and I also had to set

Now I get …

25ms OfflineMode disabled because of server configuration.
98ms Starting application myApp-100-872058226
99ms Using theme: paytheme
99ms Vaadin application servlet version: 7.6.4
106ms Setting hearbeat interval to -1sec.

And it is not reset to 60s. And I get no heartbeats from the client.

The 60 seconds and 10 second timers are hard-coded into the touchkit add-on source code.
I could not find a mention of them in any of the heartbeat related documentation.

The following is a good article written by Michael Tzukanov.
“Offline mode for TouchKit 4 mobile apps”

It helped a lot. Thanks Michael.