A data value would be an json object with a single property named "data". The value of the data property can be any valid JSON value, including deeply nested structures.
Example
{ "data": { "foo": [ "bar" ] }}
Notes
All primitive values can also be expressed as data values: Eg. the value "foo" is identical to {"data":"foo"}, and should be interchangeable.
On resynchronization, Resgate will consider two data values to be equal only if their byte sequences are equal. This means that {"foo":1,"bar":2"} and {"bar":2,"foo":1} are not seen as equal, and will generate events, even if they are actual equal JSON values. This is to simplify comparison.
Above mentioned equal comparison might be updated later, and should not be part of the protocol.
Data values are added/removed/changed as a whole unit, and there is no way to express partial mutations within a data value.
Resgate will, towards the client, replace data values that can be expressed as primitive values, with the primivite representation. Eg. { "data": null" } will be sent as simply null.
Issue
Allow values of arbitrary JSON.
Instead of implementing a completely new static resource type, a less obstructive/complex solution to allow arbitrary data would be to add a data value (similar to the resource reference value):
A data value would be an json object with a single property named
"data"
. The value of the data property can be any valid JSON value, including deeply nested structures.Example
Notes
"foo"
is identical to{"data":"foo"}
, and should be interchangeable.{"foo":1,"bar":2"}
and{"bar":2,"foo":1}
are not seen as equal, and will generate events, even if they are actual equal JSON values. This is to simplify comparison.{ "data": null" }
will be sent as simplynull
.