Phone remote: "Verbinden" does nothing after a wrong pairing code #9
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
state.wsis assigned once and never cleared. The pair button does:After a rejected code the server sends
{error:"bad_code"}and closes the socket immediately. By the time someone has retyped four digits,readyStateis alreadyCLOSED, and callingclose()on a closed socket is a no-op — no event fires, nothing reconnects. Theelse connect()branch is dead for the rest of the page's life.The only reconnect that still happens is the backoff timer from the original
onclose. AndretryDelayis never reset on this path — it grows by ×1.6 per failure up to 10 s (index.html:323-324), so the correct code inherits a multi-second wait.Failure scenario
Someone mistypes the code, sees "falscher Code", types the right one, taps Verbinden — and nothing visibly happens. The connection only retries seconds later on its own, with no feedback in between. It looks broken.
Related: the code field accepts non-numeric input (the
patternattribute is inert without a surrounding<form>), and each bogus attempt burns one of only five rate-limited tries.Suggested fix
state.wsinonclose, or checkreadyStatebefore deciding betweenclose()andconnect()retryDelaywhen the user submits a new codeFound by multi-agent code review; verified against current
app/src/main/assets/remote/index.html.Fixed in
dd612fc, shipped in v0.9.0.state.wsis cleared inonclose, and the pair button now checksreadyState <= 1before choosing betweenclose()andconnect()— so a closed socket actually reconnects instead of hitting a no-op.retryDelayis reset to 1000 ms when a new code is submitted, so the correct code no longer inherits the backoff from earlier mistakes./^[0-9]{4}$/before it is sent, so a pasted non-numeric string no longer burns one of the five attempts.