The Protocool :3

1. The Protocol

  • Connect via websocket to wss://colonq.computer/bullfrog/api/channel/listen/model.
  • Every message is either a keyframe or a diff.
  • All messages are compressed with gzip (i.e. DecompressionStream("gzip") in the browser).

1.1. A keyframe is:

  • The byte 0x00
  • Then 64 rows
  • Of 64 cells.

1.2. A diff is:

  • The byte 0x01
  • A big-endian 32-bit unsigned length value
  • Then a number of mappings equal to that length
  • A mapping is:
    • An 8-bit X coordinate
    • An 8-bit Y coordinate
    • A cell

1.3. A cell is either a foreground or a background cell.

  • A background cell is just the byte 0x00.
  • A foreground cell is the byte 0x01 followed by:
    • One unused byte
    • One 8-bit red value
    • One 8-bit green value
    • One 8-bit blue value
    • A 32-bit big-endian codepoint
    • Then optionally a second character:
      • If the next byte is 0x00, there is only one character.
      • If the next byte is 0x01, then there is another 32-bit big endian codepoint

Author: LLLL Colonq

Created: 2024-05-07 Tue 21:20

Validate