RoomClient: jitter property
Available since
@irtio/client 5.0BrowsersNodeThe jitter read-only property of the RoomClient interface is how much the round trips of the client’s recent pings vary, in milliseconds.
Value
A number of milliseconds: the mean deviation of the last 8 round trips from their mean. It’s 0 after each connection is accepted, until the room answers a ping.
Description
A steady link has a jitter close to 0. A link with a high one, such as a busy Wi-Fi network, delivers state updates unevenly, which rtt, the smallest round trip, doesn’t show.
Examples
Warning about an unsteady connection
A racing game checks the jitter every 5 seconds and warns when it’s over 30 ms.
// network-warning.ts
import type { RoomClient } from "@irtio/client";
export function watchJitter(room: RoomClient): void {
setInterval(() => {
if (room.jitter > 30) console.warn(`unsteady connection: ${Math.round(room.jitter)} ms jitter`);
}, 5000);
}
See also
RoomClient.rttsimulateNetwork(), for testing with jitter- UI kit, whose network indicator shows it
Runtime availability
| Browsers | Node | |
|---|---|---|
jitter | 5.0 | 5.0 |