Skip to content

feat(realtime): implement V2 serializer#1829

Merged
mandarini merged 1 commit into
masterfrom
feat/v2-serializer
Nov 7, 2025
Merged

feat(realtime): implement V2 serializer#1829
mandarini merged 1 commit into
masterfrom
feat/v2-serializer

Conversation

@edgurgel

@edgurgel edgurgel commented Nov 4, 2025

Copy link
Copy Markdown
Member

🔍 Description

Implement Realtime V2 Serializer

Connected to supabase/realtime#1606

What changed?

New serializer version 2.0.0 (experimental for now) supported which has:

  • Two new special types of messages: user broadcast and user broadcast push
  • Allows binary user payloads
  • Reduces the amount of JSON encoding involved server side

The default version is still 1.0.0 while 2.0.0 can be tested so real change.

Why was this change needed?

Binary payload support & more streamlined broadcasts for server side handling

📸 Screenshots/Examples

🔄 Breaking changes

  • This PR contains no breaking changes

📋 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

@github-actions github-actions Bot added the realtime-js Related to the realtime-js library. label Nov 4, 2025
@pkg-pr-new

pkg-pr-new Bot commented Nov 4, 2025

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

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

@supabase/functions-js

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

@supabase/postgrest-js

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

@supabase/realtime-js

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

@supabase/storage-js

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

@supabase/supabase-js

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

commit: eb0c799

@coveralls

coveralls commented Nov 4, 2025

Copy link
Copy Markdown

Coverage Status

coverage: 95.276% (+14.1%) from 81.151%
when pulling eb0c799 on feat/v2-serializer
into 6ee3546 on master.

@edgurgel edgurgel force-pushed the feat/v2-serializer branch 3 times, most recently from 240b4f0 to 313ae5d Compare November 6, 2025 22:08
@edgurgel edgurgel marked this pull request as ready for review November 6, 2025 22:33
@edgurgel edgurgel requested review from a team as code owners November 6, 2025 22:33
@mandarini mandarini merged commit 4589e34 into master Nov 7, 2025
26 of 27 checks passed
@mandarini mandarini deleted the feat/v2-serializer branch November 7, 2025 16:28
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

@kevinscholl369-lab kevinscholl369-lab 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.

Great work, a job well done!?

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.

5 participants