• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-swift / 24691501567

20 Apr 2026 09:32PM UTC coverage: 80.2% (+0.2%) from 80.05%
24691501567

push

github

web-flow
feat(realtime): add protocol 2.0.0 support with binary broadcast frames (#908)

* feat(realtime): add protocol 2.0.0 support with binary broadcast frames

Implement Phoenix protocol 2.0.0 for the Realtime module, matching the
JS SDK serializer behavior. Protocol version is configurable via the new
`vsn` option in RealtimeClientOptions (defaults to .v2).

Protocol 2.0.0 introduces:
- JSON array text frames for non-broadcast messages (reduces overhead)
- Binary frames (type 0x03/0x04) for broadcast messages
- Binary payload support for broadcast events (raw Data)

Key changes:
- New RealtimeSerializer handling JSON array and binary wire formats
- New RealtimeProtocolVersion enum (.v1 / .v2) with configurable vsn
- New broadcast(event:data:) API for sending binary payloads
- New onBroadcastData / broadcastDataStream APIs for receiving binary
- CallbackManager extended with BroadcastDataCallback support
- All encoding/decoding paths branch on vsn for backward compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(realtime): extract broadcast data callback predicate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(examples): add binary broadcast example for protocol v2

Adds a BinaryBroadcastView demonstrating the new binary broadcast APIs
(broadcastDataStream, broadcast with Data payload) introduced in
protocol 2.0.0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(realtime): use LockIsolated in broadcast callback tests

The two CallbackManager tests mutated a captured `var` inside
@Sendable closures, causing a compile error on Xcode 15.4 (Swift 5.10
strict concurrency). Wrap with LockIsolated to match the other tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(realtime): address review feedback on protocol v2

- Correct warning text in handleBinaryBroadcast to reference
  onBroadcastData(event:callback:) instead of onBroadcast(event:callback:)
- Clarify serializer doc commen... (continued)

340 of 446 new or added lines in 6 files covered. (76.23%)

6 existing lines in 2 files now uncovered.

6744 of 8409 relevant lines covered (80.2%)

29.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.67
/Sources/Auth/Storage/KeychainLocalStorage.swift


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc