Class HeartbeatInterceptor

java.lang.Object
org.atmosphere.cpr.AtmosphereInterceptorAdapter
org.atmosphere.interceptor.HeartbeatInterceptor
All Implemented Interfaces:
AtmosphereInterceptor, AtmosphereConfigAware, InvokationOrder

public class HeartbeatInterceptor extends AtmosphereInterceptorAdapter

An interceptor that send whitespace every in 60 seconds by default. Another value could be specified with the ApplicationConfig.HEARTBEAT_INTERVAL_IN_SECONDS in the atmosphere config. The heartbeat will be scheduled as soon as the request is suspended.

Moreover, any client can ask for a particular value with the HeaderConfig.X_HEARTBEAT_SERVER header set in request. This value will be taken in consideration if it is greater than the configured value. Client can also specify the value "0" to disable heartbeat.

Finally the server notifies thanks to the JavaScriptProtocol the desired heartbeat interval that the client should applies. This interceptor just manage the configured value and the protocol sends the value to the client.

Author:
Jeanfrancois Arcand