Skip to content

feat(realtime): update httpSend to per-event broadcast URL with binary support - #1467

Merged
spydon merged 3 commits into
mainfrom
lukasklingsbo/sdk-1018-httpsend-per-event-url
Jun 26, 2026
Merged

spydon merged 3 commits into
mainfrom
lukasklingsbo/sdk-1018-httpsend-per-event-url

Conversation

@spydon

@spydon spydon commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

What

Brings RealtimeChannel.httpSend() to parity with supabase-js (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). 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

@spydon
spydon requested a review from a team as a code owner June 25, 2026 09:35
…y support

Replace the old POST /api/broadcast endpoint (with a messages array
wrapper) with the per-event URL /api/broadcast/{topic}/events/{event},
adding ?private=true for private channels and URL-encoding the topic and
event names.

The payload is now sent directly instead of wrapped. TypedData and
ByteBuffer payloads are sent as application/octet-stream; all other
payloads are JSON-encoded. The payload parameter type widens from
Map<String, dynamic> to Object, which is backward compatible for callers.

Requires Realtime server v2.97.0 or newer.
@spydon
spydon force-pushed the lukasklingsbo/sdk-1018-httpsend-per-event-url branch from 87119d8 to f451d04 Compare June 25, 2026 09:39
@spydon
spydon changed the base branch from v3 to main June 25, 2026 09:39
@spydon spydon changed the title feat(realtime)!: update httpSend to per-event broadcast URL with binary support feat(realtime): update httpSend to per-event broadcast URL with binary support Jun 25, 2026
@github-actions github-actions Bot added the realtime This issue or pull request is related to realtime label Jun 25, 2026
@spydon
spydon merged commit 6f84df0 into main Jun 26, 2026
27 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-1018-httpsend-per-event-url branch June 26, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

realtime This issue or pull request is related to realtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants