Snap Structure
This page describes the snap structure, all kinds of snap structures, and their purpose. It also shows how to encode and decode strings in the snap structure.
Snap Empty Structure
Snap Empty chunk have the following bytes structure:
sh
// chunk header...
chunkByte[3-*] // current tick - integer
chunkByte[*] // delta tick - integerSnap Single Structure
Snap Single chunk have the following bytes structure:
sh
// chunk header...
chunkByte[3-*] // current tick - integer
chunkByte[*] // delta tick - integer
chunkByte[*] // crc - integer
chunkByte[*] // size - integer
chunkByte[*] // removed items count - integer
chunkByte[*] // updated items count - integer
chunkByte[*] // unused - integer (0)
chunkByte[*-...] // snap payloadINFO
It is recommended to check the Snap Types section for more information about these values.
Snap Slice Structure
Snap Slice chunk have the following bytes structure:
sh
// chunk header...
chunkByte[3-*] // current tick - integer
chunkByte[*] // delta tick - integer
chunkByte[*] // crc - integer
chunkByte[*] // total number - integer
chunkByte[*] // current number - integer
chunkByte[*] // size - integer
chunkByte[*] // removed items count - integer
chunkByte[*] // updated items count - integer
chunkByte[*] // unused - integer (0)
chunkByte[*-...] // snap payloadINFO
Snap Slice has a particular way to send the Snap Items. Check the Snap Slice section for more information.
Snap Item Structure
Each snap item uses variable-length integer packing for all fields:
sh
itemByte[*-...] // item type - packed integer
itemByte[*-...] // item id - packed integer
itemByte[*-...] // item-specific payload - packed integers