Skip to content

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   - integer

Snap 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 payload

INFO

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 payload

INFO

Snap Slice has a particular way to send the Snap Items. Check the Snap Slice section for more information.

Snap Item Structure

Snap Item have the following bytes structure:

sh
itemByte[0]     // item id
itemByte[1]     // id
itemByte[2-...] // payload (only integers)