Skip to content

feat(realtime): add metadata to realtime user broadcast push#1894

Merged
mandarini merged 4 commits into
masterfrom
feat/realtime-user-broadcast-push-metadata
Nov 26, 2025
Merged

feat(realtime): add metadata to realtime user broadcast push#1894
mandarini merged 4 commits into
masterfrom
feat/realtime-user-broadcast-push-metadata

Conversation

@edgurgel

@edgurgel edgurgel commented Nov 26, 2025

Copy link
Copy Markdown
Member

🔍 Description

In the future we want to be able to include some metadata using JSON to User Broadcast Push.

What changed?

Add an optional metadata to be sent as part of the User Broadcast Push. At the moment it won't send anything because we don't have any allowed metadata keys but the serializer is ready to accept those as an option.

We don't have any usage at the moment for this extra metadata but we want to have this ready for the future

Related to supabase/realtime#1629

📸 Screenshots/Examples

🔄 Breaking changes

  • This PR contains no breaking changes

No breaking changes because 2.0.0 has not been set as default serializer and not publicly advertised just yet.

📋 Checklist

  • I have read the Contributing Guidelines
  • My PR title follows the conventional commit format: <type>(<scope>): <description>
  • I have run npx nx format to ensure consistent code formatting
  • I have added tests for new functionality (if applicable)
  • I have updated documentation (if applicable)

📝 Additional notes

We don't have any usage at the moment for this extra metadata but we
want to have this ready for the future
@edgurgel edgurgel requested review from a team as code owners November 26, 2025 02:02
@github-actions github-actions Bot added the realtime-js Related to the realtime-js library. label Nov 26, 2025
@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2025

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@1894

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@1894

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@1894

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@1894

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@1894

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@1894

commit: 1c7d8c5

@coveralls

coveralls commented Nov 26, 2025

Copy link
Copy Markdown

Coverage Status

coverage: 95.367% (+14.2%) from 81.184%
when pulling 1c7d8c5 on feat/realtime-user-broadcast-push-metadata
into 2ab882b on master.

Comment thread packages/core/realtime-js/src/lib/serializer.ts Outdated
filipecabaco
filipecabaco previously approved these changes Nov 26, 2025
@mandarini mandarini merged commit 33c0b1e into master Nov 26, 2025
26 checks passed
@mandarini mandarini deleted the feat/realtime-user-broadcast-push-metadata branch November 26, 2025 09:44
grdsdev added a commit to supabase/supabase-swift that referenced this pull request Dec 5, 2025
This implements the Realtime V2 serializer based on supabase-js PRs #1829 and #1894.

Key features:
- Binary payload support for user messages
- Two new message types: user broadcast and user broadcast push
- Optional metadata support for user broadcast push messages
- Reduced JSON encoding overhead on the server side
- Backward compatible with V1 (1.0.0) as default

Changes:
- Added RealtimeBinaryEncoder and RealtimeBinaryDecoder classes
- Added RealtimeSerializer protocol for future extensibility
- Updated RealtimeClientOptions to support serializer version selection
- Updated RealtimeClientV2 to use binary serializer when v2.0.0 is selected
- Added RealtimeBinaryPayload helper for working with binary data
- Comprehensive test suite with 16 tests covering encoding/decoding scenarios

References:
- supabase/supabase-js#1829
- supabase/supabase-js#1894

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
grdsdev added a commit to supabase/supabase-py that referenced this pull request Dec 5, 2025
This implements the Realtime V2 serializer based on supabase-js PRs #1829 and #1894.

Key features:
- Binary payload support for user messages
- Two new message types: user broadcast and user broadcast push
- Optional metadata support for user broadcast push messages
- Reduced JSON encoding overhead on the server side
- Backward compatible with V1 (1.0.0) as default

Changes:
- Added Serializer class with binary encoding/decoding support
- Updated types.py to add VSN constants (VSN_1_0_0, VSN_2_0_0, DEFAULT_VSN)
- Updated AsyncRealtimeClient to support vsn parameter and serializer selection
- Added comprehensive test suite with 16 tests covering encoding/decoding scenarios
- Metadata filtering based on allowed_metadata_keys parameter

References:
- supabase/supabase-js#1829
- supabase/supabase-js#1894
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

realtime-js Related to the realtime-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants