Skip to content

Increase data packet size check to 64KB in raw data packets#948

Merged
davidliu merged 7 commits into
mainfrom
remove-data-packet-size-check
Jun 1, 2026
Merged

Increase data packet size check to 64KB in raw data packets#948
davidliu merged 7 commits into
mainfrom
remove-data-packet-size-check

Conversation

@1egoman

@1egoman 1egoman commented May 22, 2026

Copy link
Copy Markdown
Contributor

Most other client sdks (I referenced client-sdk-js, rust-sdks, and client-sdk-swift) allow a user to send a raw data packet via localParticipant.publishData which can be as long the user wants.

client-sdk-android on the other hand looks to be special, and if you send longer than 15kb, it will bail early and throw an error:

if (data.size > RTCEngine.MAX_DATA_PACKET_SIZE) {
    return Result.failure(IllegalArgumentException("cannot publish data larger than " + RTCEngine.MAX_DATA_PACKET_SIZE))
}

My initial thinking is that it might make sense to remove this check on android because none of the other sdks do it this way, and this is a low level api where the assumption would be that a user knows what they are doing / would understand the potential implications of sending a very long data packet. It wouldn't be a breaking change because removing the check is "widening" the api interface / all existing callers would still work.

I've tested this locally by sending data packets larger than 15kb to the android example app and it is able to receive it properly. If there's any more extensive testing that needs to be done here, please let me know.

@changeset-bot

changeset-bot Bot commented May 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ae165c

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

This PR includes changesets to release 1 package
Name Type
client-sdk-android 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

@github-actions

github-actions Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Diffuse output:

OLD: diffuse-source-file
NEW: livekit-android-sdk-release.aar

 AAR      │ old      │ new      │ diff   
──────────┼──────────┼──────────┼────────
      jar │    4 MiB │    4 MiB │ +119 B 
 manifest │  1.5 KiB │  1.5 KiB │    0 B 
 lint-jar │ 12.7 KiB │ 12.7 KiB │    0 B 
    other │  1.8 KiB │  1.8 KiB │    0 B 
──────────┼──────────┼──────────┼────────
    total │    4 MiB │    4 MiB │ +119 B 

 JAR     │ old   │ new   │ diff       
─────────┼───────┼───────┼────────────
 classes │  2215 │  2215 │  0 (+0 -0) 
 methods │ 42995 │ 42995 │  0 (+0 -0) 
  fields │  8403 │  8405 │ +2 (+2 -0)
AAR
 size  │ diff   │ path          
───────┼────────┼───────────────
 4 MiB │ +119 B │ ∆ classes.jar 
───────┼────────┼───────────────
 4 MiB │ +119 B │ (total)
JAR
FIELDS:

   old  │ new  │ diff       
  ──────┼──────┼────────────
   8403 │ 8405 │ +2 (+2 -0) 
  
  + io.livekit.android.room.RTCEngine TARGET_DATA_PACKET_SIZE: int
  + io.livekit.android.rpc.RpcError MAX_V1_PAYLOAD_BYTES: int

@davidliu

davidliu commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

From testing, sending packets over the max-message-size will cause the data channel to close, so instead increased the limit from 15KB to what the server negotiates (64KB - 1). Left a TODO since the limit is still hardcoded rather than examining what is negotiated.

@davidliu davidliu changed the title Remove data packet size check in raw data packets Increase data packet size check to 64KB in raw data packets Jun 1, 2026
@davidliu davidliu merged commit 3a5e32c into main Jun 1, 2026
7 checks passed
@davidliu davidliu deleted the remove-data-packet-size-check branch June 1, 2026 13:54
@davidliu davidliu mentioned this pull request Jun 1, 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.

2 participants