Skip to content

Add LocalParticipant.sendBytes - #750

Merged
1egoman merged 5 commits into
mainfrom
add-send-bytes
Oct 21, 2026
Merged

1egoman merged 5 commits into
mainfrom
add-send-bytes

Conversation

@1egoman

@1egoman 1egoman commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Adds LocalParticipant.sendBytes(data, options), the node counterpart of python-sdks' send_bytes (livekit/python-sdks#858).

It sends an in-memory Uint8Array as a complete byte stream in a single StreamSendBytesRequest. With streamBytes() every payload costs a header, a chunk and a trailer. Here the whole payload is known up front, so short payloads can go out as a single packet and larger ones can be compressed, as long as every recipient supports it. It returns the resulting ByteStreamInfo, just as sendText returns its info.

This replaces the workaround in livekit/agents-js#2769, which wrote each message to a temp file so it could use sendFile's one-shot path.

Options: topic, name (defaults to "unknown"), mimeType (defaults to "application/octet-stream"), attributes, destinationIdentities, streamId, compress (defaults to true).

No bindings bump is needed: StreamSendBytes* is already in @livekit/rtc-ffi-bindings 0.12.73.

Testing

  • New e2e test sends and receives a small in-memory buffer via sendBytes (port of python's test_send_bytes_small). It checks the returned info and the round trip.
  • Ran the byte-stream e2e tests against a local livekit-server --dev, and both passed.

🤖 Generated with Claude Code

Mirrors python-sdks send_bytes: sends a complete in-memory buffer through
the FFI StreamSendBytes request so short payloads can be inlined and larger
ones compressed, instead of callers going through streamBytes or a temp file
with sendFile.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1b6e3ec

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

This PR includes changesets to release 1 package
Name Type
@livekit/rtc-node 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

@1egoman
1egoman requested a review from lukasIO October 20, 2026 22:48
1egoman and others added 2 commits October 21, 2026 11:49
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Matches python-sdks send_bytes, which takes no progress callback.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@1egoman
1egoman marked this pull request as ready for review October 20, 2026 22:54

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread packages/livekit-rtc/src/participant.ts Outdated
Handle the expected result case, the error case, and any unexpected case
explicitly instead of collapsing everything non-success into 'unknown error'.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@1egoman
1egoman merged commit ddabfc3 into main Oct 21, 2026
14 of 16 checks passed
@1egoman
1egoman deleted the add-send-bytes branch October 21, 2026 19:39
@github-actions github-actions Bot mentioned this pull request Oct 21, 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