Skip to content

feat(realtime): add heartbeat callback #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

grdsdev
Copy link
Collaborator

@grdsdev grdsdev commented Apr 22, 2025

What kind of change does this PR introduce?

Bug fix, feature, docs update, ...

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

@grdsdev grdsdev force-pushed the guilherme/clibs-158-supabase-swift-add-heartbeat-callback branch from e927454 to 2ab61f6 Compare April 22, 2025 09:43
@coveralls
Copy link

coveralls commented Apr 22, 2025

Pull Request Test Coverage Report for Build 14715004040

Details

  • 46 of 62 (74.19%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 74.846%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Sources/Realtime/RealtimeClientV2.swift 46 62 74.19%
Totals Coverage Status
Change from base Build 14711380323: -0.03%
Covered Lines: 5109
Relevant Lines: 6826

💛 - Coveralls

@grdsdev grdsdev requested review from filipecabaco and Copilot and removed request for filipecabaco April 28, 2025 18:22
@grdsdev grdsdev marked this pull request as ready for review April 28, 2025 18:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for heartbeat callbacks to the realtime client and includes corresponding tests. Key changes include the introduction of a new HeartbeatStatus enum, modifications to the heartbeat sending and handling logic in RealtimeClientV2, and updates to test cases to verify heartbeat behavior.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Tests/RealtimeTests/RealtimeTests.swift Added new tests for heartbeat responses and timeout behavior.
Sources/Realtime/Types.swift Introduced the HeartbeatStatus enum to represent heartbeat events.
Sources/Realtime/RealtimeClientV2.swift Updated heartbeat logic, channel storage (from array to dictionary), and associated reconnection handling.
Comments suppressed due to low confidence (1)

Sources/Realtime/RealtimeClientV2.swift:505

  • [nitpick] The previous implementation returned all channels with the matching topic using a filter. Please confirm that restricting to a single channel (via the dictionary lookup) is intended, ensuring that multiple channels per topic are not expected.
return $0.channels[message.topic]

@grdsdev grdsdev force-pushed the guilherme/clibs-158-supabase-swift-add-heartbeat-callback branch from 5cd006e to cb60535 Compare April 28, 2025 18:23
@grdsdev grdsdev merged commit 5f3d75c into main Apr 29, 2025
21 of 22 checks passed
@grdsdev grdsdev deleted the guilherme/clibs-158-supabase-swift-add-heartbeat-callback branch April 29, 2025 18:19
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.

3 participants