Skip to content

Queue Bluetooth writes so fast typing no longer drops characters - #25

Merged
bdbarnett merged 1 commit into
mainfrom
fix/ble-write-queue
Oct 30, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
fix/ble-write-queue

Conversation

@bdbarnett

Copy link
Copy Markdown

Fixes #24.

Web Bluetooth allows one GATT operation at a time. The REPL sent every keystroke as its own writeValue, so typing fast started a write while the last was still in flight; the browser refused it with "GATT operation already in progress" and the character was lost.

Writes in the Bluetooth transport now go through a queue. Each writeValue waits for the one before it, and keystrokes that pile up while a write is on the air are sent together in one write, never larger than the characteristic's size.

A new test uses a mocked characteristic that throws that error whenever two writes overlap. It fails on the old code (every keystroke after the first is refused) and passes now.

@bdbarnett
bdbarnett merged commit a96e826 into main Oct 30, 2026
1 check passed
@bdbarnett
bdbarnett deleted the fix/ble-write-queue branch October 30, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Typing quickly over the Bluetooth REPL drops characters

1 participant