waitForStat v5.4
Wait for a statistics counter to change.
The request returns as soon as the counter's total differs from total. If
total is omitted, or already differs, the request returns immediately. A
client can follow a counter by passing the total from the previous reply in
the next request.
Parameter
| Key | Type | Description |
|---|---|---|
| name | string | Counter name. |
| total | number | Optional. The last seen total. The request waits until the total differs from it. |
| timeout | number | Optional. Maximum time to wait, in seconds. If omitted, the request waits indefinitely. |
Return value
| Key | Type | Description |
|---|---|---|
| name | string | Counter name. |
| total | number | Count since the printer started. |
| today | number | Count today. |
If the timeout expires, the current state is returned with an unchanged total.
The request fails if there is no counter with the given name, including if the counter is removed while waiting, for example because the printer was removed.
Example
waitForStat {"name": "printer.Colorize.labels.printed", "total": 1520, "timeout": 10}