Skip to content

feat: single broadcast api payload - #1864

Merged
edgurgel merged 10 commits into
mainfrom
feat/broadcast-api-binary-payload
May 20, 2026
Merged

edgurgel merged 10 commits into
mainfrom
feat/broadcast-api-binary-payload

Conversation

@edgurgel

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Introduce a new endpoint: POST /api/broadcast/:topic/events/:event_name where the content-type defines the type of payload (application/json vs application/octet-stream)

if the channel is private a query string can be passed ?private=true

edgurgel added 6 commits May 13, 2026 14:52
This new endpoint sends a single broadcast with a JSON or binary payload

The content-type declares what kind of payload is being sent
@edgurgel edgurgel changed the title feat: broadcast api binary payload feat: single broadcast api payload May 13, 2026
@coveralls

coveralls commented May 13, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 91.449% — feat/broadcast-api-binary-payload into main. No base build found for main.

@edgurgel
edgurgel requested a review from leandrocp May 14, 2026 09:37
@edgurgel
edgurgel requested a review from leandrocp May 19, 2026 03:28
@edgurgel
edgurgel merged commit 5fa319f into main May 20, 2026
15 checks passed
@edgurgel
edgurgel deleted the feat/broadcast-api-binary-payload branch May 20, 2026 01:21
@realtime-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.97.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

spydon added a commit to supabase/supabase-flutter that referenced this pull request Jun 26, 2026
…y support (#1467)

## What

Brings `RealtimeChannel.httpSend()` to parity with supabase-js
([supabase/supabase-js#2400](supabase/supabase-js#2400)).

- Uses the new per-event URL format `POST
/api/broadcast/{topic}/events/{event}` instead of the old `POST
/api/broadcast` with a `messages` array wrapper.
- Adds `?private=true` query parameter for private channels.
- URL-encodes the topic and event names.
- Sends the payload directly (no `messages` wrapper).
- `TypedData` (e.g. `Uint8List`) and `ByteBuffer` payloads are sent as
`application/octet-stream`; everything else is JSON-encoded.
- Returns a clearer error when the server responds with 404 (server too
old).

The implicit REST fallback in `send()` is intentionally left on the old
format, matching supabase-js, which only changed `httpSend()`.

## Compatibility

- The `payload` parameter type widens from `Map<String, dynamic>` to
`Object` to allow binary payloads. This is backward compatible: existing
calls passing a map still compile.
- The new endpoint requires Realtime server **v2.97.0+**
([supabase/realtime#1864](supabase/realtime#1864)).
This matches supabase-js, which shipped the same change as a minor
`feat`.

## Test plan

- Updated `httpSend` tests for the new URL format and direct payload
body.
- Added tests for the `private` query parameter (present for private,
absent for public), URL-encoding of special characters, and
`Uint8List`/`ByteBuffer` binary payloads.

Closes SDK-1018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants