Search in sources :

Example 1 with HeartbeatEvent

use of com.vaadin.flow.component.HeartbeatEvent in project flow by vaadin.

the class UIInternals method setLastHeartbeatTimestamp.

/**
 * Sets the last heartbeat request timestamp for the related UI. Called by
 * the framework whenever the application receives a valid heartbeat request
 * for the UI.
 * <p>
 * This method is not intended to be overridden. If it is overridden, care
 * should be taken since this method might be called in situations where
 * {@link UI#getCurrent()} does not return the UI.
 *
 * @param lastHeartbeat
 *            The time the last heartbeat request occurred, in milliseconds
 *            since the epoch.
 */
public void setLastHeartbeatTimestamp(long lastHeartbeat) {
    lastHeartbeatTimestamp = lastHeartbeat;
    HeartbeatEvent heartbeatEvent = new HeartbeatEvent(ui, lastHeartbeat);
    getListeners(HeartbeatListener.class).forEach(listener -> listener.heartbeat(heartbeatEvent));
}
Also used : HeartbeatEvent(com.vaadin.flow.component.HeartbeatEvent) HeartbeatListener(com.vaadin.flow.component.HeartbeatListener)

Aggregations

HeartbeatEvent (com.vaadin.flow.component.HeartbeatEvent)1 HeartbeatListener (com.vaadin.flow.component.HeartbeatListener)1