Skip to content

Fix SCTP SNAP preservation during ICE configuration updates - #482

Open
MSNexploder wants to merge 1 commit into
livekit:mainfrom
MSNexploder:preserve-sctp-snap-updates
Open

MSNexploder wants to merge 1 commit into
livekit:mainfrom
MSNexploder:preserve-sctp-snap-updates

Conversation

@MSNexploder

Copy link
Copy Markdown

Preserve SCTP SNAP through React Native configuration updates

registerGlobals() enables SCTP SNAP in its peer-connection constructor shim. Later join/reconnect ICE updates omit the option because livekit-client owns a separate configuration object. Native parsing defaults the missing option to false, but SCTP SNAP is immutable, so the ICE update can be rejected.

Change

Extend the existing SctpSnapPeerConnection shim to remember the boolean selected at construction and supply it as the default in setConfiguration(). Explicit constructor false and explicit update values still win. This keeps ownership beside the SDK code that introduces the default; the shared JavaScript SDK and native WebRTC wrapper need no changes.

The native configuration default, equality check, and immutable-field validation explain the rejected update. The React Native constructor shim and JavaScript SDK configuration creation show the concrete path.

Minimal reproduction

import { registerGlobals } from '@livekit/react-native';

registerGlobals();
const pc = new RTCPeerConnection();
pc.setConfiguration({
  iceServers: [{ urls: 'stun:stun.example.org:3478' }],
});

Use the registered global constructor. The STUN URI is a placeholder. Before the fix, construction sends enableSctpSnap: true, but the update omits it. Afterward, both send true.

Testing

The regression uses the real registerGlobals() shim and unpatched WebRTC class with native-boundary mocks. Six cases cover default/explicit values, repeated ICE updates, explicit change requests, separate connections, and frozen update objects.

yarn install --immutable
yarn typescript
yarn lint
yarn test --runInBand
yarn prepare
yarn build-docs --treatWarningsAsErrors
  • Before the fix: three regression failures and three passing controls.
  • Afterward: all three suites / 11 tests pass.
  • Type-check, lint, library build, and strict documentation build pass.

Native join/reconnect validation remains outstanding.

@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bfd2c9b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@livekit/react-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@MSNexploder
MSNexploder marked this pull request as ready for review October 23, 2026 19:23

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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