web: live run updates over a single app-wide watch (R10)
This commit is contained in:
@@ -118,6 +118,26 @@ export class PipelinesClient extends EventTarget {
|
||||
return run;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends one request without awaiting a reply, returning the generated id
|
||||
* (mirrors the Android `PipelinesClient.sendOnly`). Used for the run-event
|
||||
* watch: `subscribe` may never be acknowledged, so registering a pending entry
|
||||
* would leave it to time out, and `unsubscribe` has nothing to read back.
|
||||
*
|
||||
* The send is synchronous so back-to-back frames (`unsubscribe` then
|
||||
* `subscribe`) keep their order on the wire; the id is still available so a
|
||||
* server that does ack (or refuses) has its reply surface as an unsolicited
|
||||
* `frame` event with that id. A call before the socket is connected is refused
|
||||
* with `NotConnectedError`, exactly like `call`.
|
||||
*/
|
||||
sendOnly(request) {
|
||||
const socket = this.#ws;
|
||||
if (!socket || this.#state.kind !== CONNECTED) throw new NotConnectedError();
|
||||
const id = `web-${++this.#seq}`;
|
||||
socket.send(JSON.stringify({ ...request, id }));
|
||||
return id;
|
||||
}
|
||||
|
||||
async #doCall(request) {
|
||||
const socket = this.#ws;
|
||||
if (!socket || this.#state.kind !== CONNECTED) throw new NotConnectedError();
|
||||
|
||||
Reference in New Issue
Block a user