public static class Frame.Heartbeat extends Object
heartbeat
header.
This class is thread-safe.Constructor and Description |
---|
Heartbeat(int x,
int y) |
Modifier and Type | Method and Description |
---|---|
static long |
computePingPeriod(Frame.Heartbeat client,
Frame.Heartbeat server)
Computes the ping period.
|
static long |
computePongPeriod(Frame.Heartbeat client,
Frame.Heartbeat server)
Computes the pong period.
|
static Frame.Heartbeat |
create(JsonObject json)
Creates an instance of
Frame.Heartbeat from the JSON configuration provides in the
client / server options. |
static Frame.Heartbeat |
parse(String header)
Creates an instance of
Frame.Heartbeat from the heartbeat header of a frame
. |
String |
toString() |
public static Frame.Heartbeat parse(String header)
Frame.Heartbeat
from the heartbeat header
of a frame
. If the header is null
, the (0,0) configuration is returned.header
- the headerpublic static Frame.Heartbeat create(JsonObject json)
Frame.Heartbeat
from the JSON configuration provides in the
client / server options. The JSON is structure as follows: {"x": 1000, "y": 1000}
. The x
and
y
time are given in milliseconds.json
- the json object configuring the heartbeat.public String toString()
public static long computePingPeriod(Frame.Heartbeat client, Frame.Heartbeat server)
ping
to the other party every x milliseconds, where x
is the value returned by this method. The value is computed from the two parties heartbeat configuration.client
- the client configurationserver
- the server configurationpublic static long computePongPeriod(Frame.Heartbeat client, Frame.Heartbeat server)
client
- the client configurationserver
- the server configurationCopyright © 2024 Eclipse. All rights reserved.