braid-spec
braid-spec copied to clipboard
Animating a PNG example: Semantics unclear?
In section 5.1 it has this example:
Request:
GET /animated-braid.png
Subscribe
Response:
HTTP/1.1 209 Subscribe
Subscribe
Content-Type: image/png | Version
Patches: 2 |
|
Content-Length: 1239 | | Patch
Content-Range: bytes=100-200 | |
| |
<binary data> | |
|
Content-Length: 62638 | | Patch
Content-Range: bytes=348-887 | |
| |
<binary data> | |
This is a weird use case:
- Its almost impossible to figure out a binary patch to a PNG because the content is internally gzipped iirc. (if you do, you'll probably end up with a patch that just replaces the entire contents of the file)
- Its unclear whether this overwrites the specified bytes or truncates? Like, what happens if the new content is smaller than the old content? (And I might be revealing my ignorance of the
content-range: bytes=
header by asking this, but how does this format indicate the size of the file should be truncated?
The example might be better either:
- Using a bitmap instead of a PNG - because then the byte ranges at least make a bit of sense, and the file size will stay constant
- Or don't use patches in this example, and simply re-send the content with each change
- And we can write a second example which uses patches
A better example might also be modifying HTML from the server in an "animated" sort of way.
Closing as duplicate of https://github.com/braid-org/braid-spec/issues/77