Class Heartbeat

java.lang.Object
com.vaadin.client.communication.Heartbeat

public class Heartbeat extends Object
Handles sending of heartbeats to the server and reacting to the response
Since:
1.0
Author:
Vaadin Ltd
  • Constructor Summary

    Constructors
    Constructor
    Description
    Heartbeat(Registry registry)
    Creates a new instance connected to the given registry.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the heartbeat interval.
    void
    Updates the schedule of the heartbeat to match the set interval.
    void
    Sends a heartbeat to the server.
    final void
    setInterval(int heartbeatInterval)
    Changes the heartbeatInterval in runtime and applies it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Heartbeat

      public Heartbeat(Registry registry)
      Creates a new instance connected to the given registry.
      Parameters:
      registry - the global registry
  • Method Details

    • send

      public void send()
      Sends a heartbeat to the server.
    • getInterval

      public int getInterval()
      Gets the heartbeat interval.
      Returns:
      the interval at which heartbeat requests are sent.
    • schedule

      public void schedule()
      Updates the schedule of the heartbeat to match the set interval. A negative interval disables the heartbeat.
    • setInterval

      public final void setInterval(int heartbeatInterval)
      Changes the heartbeatInterval in runtime and applies it.
      Parameters:
      heartbeatInterval - new interval in seconds.