Skip to main content

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​

KeyTypeDescription
namestringCounter name.
totalnumberOptional. The last seen total. The request waits until the total differs from it.
timeoutnumberOptional. Maximum time to wait, in seconds. If omitted, the request waits indefinitely.

Return value​

KeyTypeDescription
namestringCounter name.
totalnumberCount since the printer started.
todaynumberCount 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}