IoT Bricks Path Try challenge Blog Sign in

Invitation-only preview

IoT Bricks

Build your own IoT backend, brick by brick.

A message broker, event ingestion, a time-series database and a live gateway. You write each brick; the tester says exactly what to fix.

Try challenge: stage 1 See the path

Picture a greenhouse with a thousand sensors. Lose their messages, and a frost goes unnoticed; trust a faulty reading, and you raise a false alarm. Each brick is one answer to that.

The path

Four bricks, from sensor to dashboard. Pick one.

Message broker. Connections, pub/sub, delivery guarantees, sessions, retained messages, last will, keep-alive. stages 1-3 free

Ingestion. Validate, normalise and store the events your sensors send. coming soon

Time-series database. Write and query series of measurements. coming soon

Live gateway. Push measurements to the browser as they arrive. coming soon

What the tester tells you

~/iotbricks-mqtt-go
04 Publish and subscribe 05 Topic filters and wildcards 06 QoS 1: acknowledged delivery 07 Persistent sessions 08 Retained messages 09 Last Will 10 Keep-alive
$ iotbricks test local --stage 1
Stage 1: Accept a connection
✓ The port accepts TCP connections
✓ A valid CONNECT is answered with a CONNACK (code 0)
✗ A first packet that is not CONNECT closes the connection
expected your program to close the connection without replying
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 broken broker listening on :1883
✗ An unsupported protocol level is rejected with code 0x01
unexpected bytes for a CONNACK refusing the protocol level
expected: 20 02 00 01
received: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 broken broker listening on :1883
Stage 1 failed (2/4 tests passed).
# after the fix
Stage 1: Accept a connection
✓ The port accepts TCP connections
✓ A valid CONNECT is answered with a CONNACK (code 0)
✓ A first packet that is not CONNECT closes the connection
✓ An unsupported protocol level is rejected with code 0x01
Stage 1 passed (4/4 tests).
$ iotbricks test local --stage 2
Stage 2: Read packets from a TCP stream
✗ A PINGREQ after the CONNACK is answered with a PINGRESP
expected a PINGRESP (D0 00) for the PINGREQ (C0 00)
expected: D0 00
received: (no bytes) - nothing more within 2s
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ Remaining length 127 is decoded (1 length byte(s): 7F)
expected a PINGRESP for the PINGREQ that arrived right behind the CONNECT in the same TCP segment
expected: D0 00
received: (no bytes) - nothing more within 2s
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ Remaining length 128 is decoded (2 length byte(s): 80 01)
expected a PINGRESP for the PINGREQ that arrived right behind the CONNECT in the same TCP segment
expected: D0 00
received: (no bytes) - nothing more within 2s
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ Remaining length 16383 is decoded (2 length byte(s): FF 7F)
expected a PINGRESP for the PINGREQ that arrived right behind the CONNECT in the same TCP segment
expected: D0 00
received: (no bytes) - nothing more within 2s
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ Remaining length 16384 is decoded (3 length byte(s): 80 80 01)
expected a PINGRESP for the PINGREQ that arrived right behind the CONNECT in the same TCP segment
expected: D0 00
received: (no bytes) - nothing more within 2s
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A remaining length longer than 4 bytes closes the connection
expected your program to close the connection without replying: a remaining length is at most 4 bytes long
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A CONNECT arriving one byte at a time is accepted
could not send 00: write tcp 127.0.0.1:1883->127.0.0.1:1883: write: broken pipe
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A remaining length split across TCP segments is decoded
expected your program to wait for the end of the packet before answering
but your program closed the connection
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A CONNECT cut in the middle of its body does not crash the broker
expected your program to close the connection after the client hung up mid-packet
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A packet cut in the middle of its remaining length does not crash the broker
expected your program to close the connection after the client hung up mid-packet
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A huge announced length with no body does not crash the broker
expected your program to close the connection after the client hung up mid-packet
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
Stage 2 failed (0/11 tests passed).
# after the fix
Stage 2: Read packets from a TCP stream
✓ A PINGREQ after the CONNACK is answered with a PINGRESP
✓ Remaining length 127 is decoded (1 length byte(s): 7F)
✓ Remaining length 128 is decoded (2 length byte(s): 80 01)
✓ Remaining length 16383 is decoded (2 length byte(s): FF 7F)
✓ Remaining length 16384 is decoded (3 length byte(s): 80 80 01)
✓ A remaining length longer than 4 bytes closes the connection
✓ A CONNECT arriving one byte at a time is accepted
✓ A remaining length split across TCP segments is decoded
✓ A CONNECT cut in the middle of its body does not crash the broker
✓ A packet cut in the middle of its remaining length does not crash the broker
✓ A huge announced length with no body does not crash the broker
Stage 2 passed (11/11 tests).
$ iotbricks test local --stage 3
Stage 3: Parse and validate CONNECT
✓ A CONNECT with every field (will, username, password) is accepted
✓ An empty client ID is accepted when clean session is set
✗ An empty client ID without clean session is refused with code 0x02
unexpected bytes for a CONNACK with return code 0x02 (identifier rejected)
expected: 20 02 00 02
received: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A wrong protocol name closes the connection
expected your program to close the connection without replying: the protocol name must be exactly "MQTT"
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A non-zero fixed header flag closes the connection
expected your program to close the connection without replying: the flag bits of a CONNECT's first byte must be zero
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A non-zero reserved connect flag closes the connection
expected your program to close the connection without replying: bit 0 of the connect flags is reserved and must be zero
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A will flag without will topic and message closes the connection
expected your program to close the connection without replying: the will flag announces a will topic and message that are missing
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A password flag without username flag closes the connection
expected your program to close the connection without replying: a password requires a username
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ A field longer than the rest of the packet closes the connection
expected your program to close the connection without replying: a field announces more bytes than the packet contains
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
✗ Trailing bytes after the payload close the connection
expected your program to close the connection without replying: the packet must be consumed exactly: bytes are left over after the last field
but your program sent: 20 02 00 00
your program's output:
| 2026/01/01 00:00:00 naive broker listening on :1883
Stage 3 failed (2/10 tests passed).
# after the fix
Stage 3: Parse and validate CONNECT
✓ A CONNECT with every field (will, username, password) is accepted
✓ An empty client ID is accepted when clean session is set
✓ An empty client ID without clean session is refused with code 0x02
✓ A wrong protocol name closes the connection
✓ A non-zero fixed header flag closes the connection
✓ A non-zero reserved connect flag closes the connection
✓ A will flag without will topic and message closes the connection
✓ A password flag without username flag closes the connection
✓ A field longer than the rest of the packet closes the connection
✓ Trailing bytes after the payload close the connection
Stage 3 passed (10/10 tests).
  • 10 stages
  • 4 bricks, 1 live
  • one language per course
  • first 3 stages free

Start with stage 1

Free, runs on your computer, nothing to sign up for.

Try challenge: stage 1