Skip to content

feat: serializer behaviour and vsn 2.0.0 binary framing - #43

Merged
zoedsoupe merged 3 commits into
mainfrom
feat/rt-serializer-vsn2
Oct 16, 2026
Merged

zoedsoupe merged 3 commits into
mainfrom
feat/rt-serializer-vsn2

Conversation

@zoedsoupe

Copy link
Copy Markdown
Member

Problem

Message serialization was hardcoded: vsn was fixed at 1.0.0 and every frame was JSON. There was no seam to override encode/decode, and no support for vsn 2.0.0, which the server and realtime-js use (array JSON plus a binary framing for user broadcasts that saves bandwidth).

Solution

Add a Supabase.Realtime.Serializer behaviour with two implementations: V1 (JSON objects, the default) and V2 (array JSON plus kind-3/kind-4 binary user-broadcast framing). The Connection resolves the serializer at init, puts the negotiated vsn in the websocket query string (authoritative over :params), and routes both text and binary frames through it. A custom module can be supplied with :serializer.

Rationale

The behaviour is the extension point the gap list asked for: any module implementing it replaces both encode and decode, so no separate hook options are needed. V2 matches the realtime-js serializer.ts and the server's V2Serializer byte for byte, including UTF-8 byte-length prefixes and the 255-byte field guards. The default stays 1.0.0 so existing users see no change; 2.0.0 is opt-in.

@zoedsoupe
zoedsoupe added this pull request to stack #45 October 16, 2026 01:44
@zoedsoupe
zoedsoupe force-pushed the feat/rt-serializer-vsn2 branch from 6377106 to bcdd8e1 Compare October 16, 2026 22:04
Base automatically changed from feat/rt-protocol-correctness to main October 16, 2026 22:22
@zoedsoupe
zoedsoupe force-pushed the feat/rt-serializer-vsn2 branch from fd23c5a to 7e25b4a Compare October 16, 2026 22:22
@zoedsoupe
zoedsoupe merged commit 3aec1d6 into main Oct 16, 2026
24 checks passed
@zoedsoupe
zoedsoupe deleted the feat/rt-serializer-vsn2 branch October 16, 2026 22:24
@zoedsoupe zoedsoupe mentioned this pull request Oct 16, 2026
zoedsoupe added a commit that referenced this pull request Oct 19, 2026
🚀 Want to release this?
---


##
[0.6.0](v0.5.0...v0.6.0)
(2026-10-16)


### Features

* filter builder, select, heartbeat telemetry and presence fixes
([#44](#44))
([6fa0dae](6fa0dae))
* rejoin backoff, duplicate binding dedup and aligned binding ids
([#46](#46))
([ce458d9](ce458d9))
* serializer behaviour and vsn 2.0.0 binary framing
([#43](#43))
([3aec1d6](3aec1d6))


### Bug Fixes

* realtime protocol correctness (join, ack, heartbeat, tls)
([#42](#42))
([73548ac](73548ac))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

1 participant