Skip to content

Support several mDNS browsers at the same time (OpenBikeControl over Wi-Fi) - #479

Closed
jonasbark wants to merge 1 commit into
incyclist:mainfrom
jonasbark:openbikecontrol
Closed

jonasbark wants to merge 1 commit into
incyclist:mainfrom
jonasbark:openbikecontrol

Conversation

@jonasbark

@jonasbark jonasbark commented Nov 6, 2026 •

Copy link
Copy Markdown

Companion to the OpenBikeControl PR in incyclist/devices (incyclist/devices#141). That PR adds a second mDNS search, for _openbikecontrol._tcp, next to the Wahoo Direct Connect search.

react-native-zeroconf only runs one scan at a time, so today the last find() call replaces the earlier ones, and every result is passed to every callback labelled with that callback's own type. This change lets both searches coexist:

Changes

  • src/bindings/direct-connect/mdns/binding.ts: one browser per requested type. A new browser starts immediately, then all browsers take turns every 5 s. Each result goes only to the callbacks of the type it was actually found under (taken from the resolved fullName, falling back to the active scan). With a single type, nothing changes: one scan, no rotation.
  • src/bindings/direct-connect/mdns/binding.test.ts: rotation, per-type delivery (iOS and Android fullName formats), fallback, results without an address, disconnect.

Testing

  • npx jest, npx eslint src/bindings/direct-connect/mdns/, npx tsc --noEmit

The devices change is safe with or without this one: without it, Direct Connect discovery on mobile works as before, but OpenBikeControl devices aren't found over Wi-Fi.

react-native-zeroconf only supports one active scan, so far the last
find() call replaced the previous scans and every result was reported
to all callbacks, labelled with the callback's own type.

The binding now keeps one browser per requested type: a new browser is
started immediately, then all browsers take turns every 5s. Each result
is only reported to the callbacks of the type it was found under (taken
from the resolved full name, falling back to the active scan). This
allows OpenBikeControl (_openbikecontrol._tcp) and Wahoo Direct Connect
(_wahoo-fitness-tnp._tcp) discovery to coexist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@jonasbark
jonasbark marked this pull request as ready for review November 6, 2026 11:23
Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@gdoumen

gdoumen commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

PLease use #481 instead

@gdoumen gdoumen closed this Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants