Repository navigation
Let the server read the platform of web clients - #1336
Draft
hiroshihorie wants to merge 1 commit into
Draft
hiroshihorie wants to merge 1 commit into
hiroshihorie wants to merge 1 commit into
Conversation
On web the SDK sent os as defaultTargetPlatform.name, which is the same string native builds send (macOS, iOS, android, windows, linux). The server fills os, os_version, browser, browser_version and device_model from the User-Agent only when the client leaves them empty, so web clients ended up with a native looking os and no os_version. Web now sends none of them, as the JS SDK does. Windows now reports os_version (major.minor.build). Linux reported the machine id, a unique id of the installation, as device_model. It now reports the hardware model from the firmware tables or the device tree, as the Rust SDK does. Room.connect logs one line naming the SDK version and the platform.
Contributor
|
This PR bumps
|
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.
Problem
On web,
_clientInfo()sentos: defaultTargetPlatform.name. That is the same string native builds send (macOS,iOS,android,windows,linux), so theosfield alone can't tell Flutter web on a Mac from native macOS.The server already parses the User-Agent for
FLUTTERclients (AugmentClientInfoin livekitpkg/service/utils.go, both/rtcand/rtc/v1), but it only fillsos,os_version,browser,browser_versionanddevice_modelwhen the client left them empty. Because the SDK setos, web clients never got the parsed os and os_version.Changes
isSafari,isFirefox, client configuration rules), which only the server parser produces.os_versionasmajor.minor.build(for example10.0.26100), the same shape the Rust SDK sends. A failed read is logged and does not fail the connect.device_modelwasmachineId, a unique id of the installation rather than a model. It now reads/sys/class/dmi/id/product_nameor/proc/device-tree/model, as the Rust SDK does.Room.connectlogs one line naming the SDK version and platform, like the Swift SDK's connect log. For exampleflutter 2.15.0, macOS 26.2 MacBookPro18,3orflutter 2.15.0, web, chrome 143.0 on macOS.Verification
Connected from
flutter test --platform chrometo a locallivekit-server --dev(1.13.11) and read theclientInfothe server logged.Before (origin/main):
(
androidbecause flutter_test setsdefaultTargetPlatformto android. In a real browser it ismacOS.)After:
Native Flutter's
Dart/x (dart:io)User-Agent parses to browserOther, so the server now separates web from native by bothosandbrowser.Also ran
flutter analyze,dart format,import_sorter,check_versionandflutter test test/core test/utils_test.dart. I couldn't run the Windows and Linux branches on this machine.Other SDKs compared
iOS/macOS/visionOS/tvOSutsname/ IOKit modelandroidBuild.VERSION.RELEASEMANUFACTURER MODELos_infotypeos_infoversionNot changed here:
modelonly, the Android SDK sendsmanufacturer model. Aligning them would break continuity in analytics, so it is left for a separate decision.other_sdks. It could report thelivekit_fficore or components-flutter versions.Follow-ups outside this repo
ClientInfo.isWebKit()only checksos == iosfor JS and Unity WebGL. Flutter web on iOS (Mobile Safari,Chrome Mobile iOS) isn't treated as WebKit, so it gets audio RED and transceiver reuse. That was already the case before this PR.sdkplusoscan't separate it from native Flutter iOS, butbrowsercan (native parses toOther).lkBrowser()checks the vendor for Chrome before checking forEdg/, so Edge is detected as chrome. Only the new log line and SDK-internal checks use it, not the client info.