Skip to content

Instantly share code, notes, and snippets.

@mar-v-in

mar-v-in/CBOR.md Secret

Created May 20, 2024 15:53

CBOR (61 bytes): x'A4' x'64' "type" x'68' "keyboard" x'69' "device_id" x'6A' "device_123" x'69' "timestamp" x'FB' x'41D985596D400000' x'63' "key" 'x'61 "A"

JSON (79 bytes): {"type":"keyboard","device_id":"device_123","timestamp":1712678325.0,"key":"A"}

XML in jingle XML stream (assuming namespace declared on <stream/>) (79 bytes): <x:e type="keyboard" device-id="device_123" timestamp="1712678325.0" key="A" />

In all packets add the following overheads for using WebRTC datachannels:

  • SCTP: 28 bytes
  • DTLS: 20 bytes
  • UDP: 8 bytes
  • Overhead for IP depending on IP version used

XMPP message via jingle XML stream (118 bytes): <message><e type="keyboard" device-id="device_123" timestamp="1712678325.0" key="A" xmlns="urn:xmpp:rc:0" /></message>

XMPP message via regular connection (124 bytes + jid length): <message to="device@example.com"><e type="keyboard" device-id="device_123" timestamp="1712678325.0" key="A" xmlns="urn:xmpp:rc:0" /></message>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment