ProgressNotification

A typed notifications/progress payload, per basic/utilities/progress: the notification carries params: {progressToken, progress, total?, message?}. progressToken correlates the update to the request that supplied it (a string or integer; see ProgressToken), progress is the current amount (which "MUST increase with each notification"), total the optional final amount, and message an optional human-readable description. Parsed from an inbound notification's params so clients receive a structured value rather than hand-parsing raw JSON.

Members

Functions

matches
bool matches(ProgressToken tok)

Whether this notification's progressToken is the one carried by tok (compares against tok.toJson()), so a client can match an incoming notifications/progress to the originating request regardless of whether the token is a string or an integer.

progressTokenString
string progressTokenString()

The progress token rendered as a string, or "" when it is absent or not a string-typed token. Convenience for callers that keyed their in-flight requests by a string token; for an integer token prefer matches.

Static functions

fromJson
ProgressNotification fromJson(Json params)

Parse the params object of a notifications/progress message. Tolerant of a missing/ill-typed payload (returns a default-valued struct), and accepts progress/total as either integer or floating-point JSON.

Variables

message
Nullable!string message;

An optional human-readable progress message.

progress
double progress;

The current progress amount.

progressToken
Json progressToken;

The progress token from the originating request (string or integer); Json.undefined if absent. Compare against the ProgressToken you sent.

total
Nullable!double total;

The optional total amount of work (null when the server omits it).