fix(web): stop advertisement watching before GATT connect - #310
Draft
usmanmehmood55 wants to merge 2 commits into
Draft
usmanmehmood55 wants to merge 2 commits into
usmanmehmood55 wants to merge 2 commits into
Conversation
- Await advertisement subscription cancellation and browser unwatching before connection attempts. - Preserve caller-provided connection timeouts and Web advertisement support. - Clear stale service state after failed Web GATT connections.
usmanmehmood55
force-pushed
the
fix/web-advertisement-connect
branch
from
September 22, 2026 10:26
eeff4c4 to
dbd0e3a
Compare
usmanmehmood55
marked this pull request as draft
September 23, 2026 07:33
- Wait for a fresh advertisement before reconnecting to a previously used device. - Fall back to the normal GATT connection when advertisement watching is unavailable or times out. - Reset reconnect tracking after the browser returns a freshly selected device. - Cancel stale connection and characteristic subscriptions before disconnecting. - Clear cached services and stop advertisement watching during teardown. - Emit the disconnected state explicitly after native disconnection.
Contributor
|
@usmanmehmood55 are you done with the changes? Should the PR be in draft? |
Contributor
Author
|
@fotiDim I'd like to throughly test these changes, so in draft right now. Rapidly connecting/disconnecting and auto-reconnect has shown lots of problems on web, so I want to make sure I'm fixing it in the right place (in my app or in universal_ble). Probably I'll submit it for review on Tuesday. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
On Web, BLE scan, disconnect, and reconnect cleanup could overlap with a new GATT connection. Chrome could begin connecting while advertisement watching was still stopping, or reconnect using stale service and subscription state. This caused intermittent connection failures that often succeeded on retry.
Changes
Validation
flutter analyzepassed.flutter testpassed.