Skip to content

Migrate toward Network framework transport - #22

Open
rchatham wants to merge 11 commits into
masterfrom
feature/network-framework-migration
Open

Migrate toward Network framework transport#22
rchatham wants to merge 11 commits into
masterfrom
feature/network-framework-migration

Conversation

@rchatham

@rchatham rchatham commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Begins migrating PeerConnectivity away from direct MultipeerConnectivity internals by adding framework-neutral seams and a Network framework prototype path while preserving the existing public API.

Changes

  • Add a Network framework migration plan documenting dependency surfaces, risks, phases, and testing strategy.
  • Add internal transport seams around session, browser, advertiser, and advertiser assistant responsibilities.
  • Introduce framework-neutral PeerIdentity while keeping Peer source-compatible with current MultipeerConnectivity-backed behavior.
  • Add Network protocol primitives for Bonjour service naming, handshakes, and framed messages.
  • Add a stream-safe Network frame decoder for partial/coalesced TCP receives while preserving frame kind and bounding payload size.
  • Add a prototype Network transport using NWConnection, NWListener, and NWBrowser with peer-to-peer enabled and TLS parameters documented as gated scaffolding until app-configurable identity/PSK verification is added.
  • Add duplicate connection resolution and connection state mapping for Network-backed peers.
  • Add Network data sending over .data frames.
  • Add a Network peer coordinator that bridges handshakes, data frames, connection registration, and discovery events into existing PeerConnectivity event seams.
  • Reject self discovery and self handshakes in the Network coordinator.
  • Serialize Network coordinator/registry state mutations and clean up duplicate replacement bookkeeping.
  • Keep PeerIdentity generation compatible with the package's declared deployment targets.

Verification

  • swift test
  • xcodebuild test -project PeerConnectivity.xcodeproj -scheme PeerConnectivity -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' -configuration Debug

Notes / Follow-ups

  • Network backend is not publicly selectable yet; current public behavior remains MultipeerConnectivity-backed.
  • multipeerSession: MCSession remains the largest public API compatibility constraint for any future iOS 27+ MC removal path.
  • Resource transfer, stream compatibility, invite UI semantics, connection/discovery caps, handshake timeouts, and a public backend selector remain follow-up work.
  • Before exposing the Network backend publicly, add app-configurable TLS identity or PSK verification so peer identities are authenticated rather than self-asserted.
  • The iOS 27 MultipeerConnectivity deprecation/removal assumption still needs verification against Apple SDK headers or release notes.

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.

1 participant