Constraint-driven peer-to-peer messaging protocol over Bluetooth Low Energy. Custom 4-step mutual handshake state machine, dynamic MTU negotiation, reliable packet chunking, and session hardening on Android 13–16.

Bluetooth Low Energy is an inherently lossy, asynchronous, and fragile transport: packets drop silently, MTU limits vary by radio chipset, and concurrent callbacks cause hard GATT race conditions. Building a serverless chat system required designing a formal communication protocol from scratch with guaranteed message delivery, flow control, and session hardening.
Engineered a strict 4-step mutual handshake state machine (HANDSHAKE_INIT → ACK → CONFIRM → CONFIRM_ACK) enforcing mutual SUCCESS verification and deterministic client/server role allocation before data transmission.
Defined a frozen wire-frame protocol ([TYPE][FLAGS][MSG_ID][CHUNK_IDX][TOTAL][TTL][PAYLOAD]) with dynamic MTU adaptation and serialized single-chunk transmission locked to BLE write callbacks.
Implemented atomic message reassembly and explicit ACK/NACK signaling emitted only after full payload verification, eliminating partial message corruption.
Hardened session security against hostile transport states: enforced rolling message IDs for replay protection, TTL packet expiration, link-drop recovery, and detailed protocol audit logging.