CanWriteValue
The CanWriteValue type describes a function that decides whether a client may write a given Value on a path of a WsServer.
(
pathId: Id,
valueId: Id,
value: ValueOrUndefined,
context: {[key: string]: any} | undefined,
): boolean| Type | Description | |
|---|---|---|
pathId | Id | The |
valueId | Id | |
value | ValueOrUndefined | The new |
context | {[key: string]: any} | undefined | The context from the client's |
| returns | boolean | Whether the client may write the |
It is called for each Value in the changes that a writable client sends to the server, including deletions, where the value parameter is undefined. It must be synchronous. Values for which it returns false are neither merged into the path's MergeableStore nor relayed to other clients.
If the rejected change was newer than the server's own version of that Value, and different from it, the server sends that client alone its own version (or a deletion, if it has none), stamped just after the rejected change. The client is brought back into line with the server, rather than silently diverging from it, and nothing changes on the server or for any other client.
This function decides only about Values. Unless you also provide a CanWriteCell function, every writable client may write any Cell. And unless you provide an Authorize function, every client is admitted as writable, with an undefined context.
Since
v10.1.0