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

supabase / supabase-py / 41633202749 / 3
99%
main: 99%

Build:
DEFAULT BRANCH: main
Ran 03 Nov 2026 12:12PM UTC
Files 20
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Nov 2026 12:08PM UTC coverage: 96.853%. Remained the same
41633202749.3

push

github

web-flow
fix(realtime): rejoin the channel after a presence callback is added while joined (#1686)

## What kind of change does this PR introduce?

Bug fix.

## What is the current behavior?

Adding a presence callback to a joined channel calls `_resubscribe()`.
It unsubscribes and then calls `subscribe()`, which raises because the
channel has already subscribed once. The channel has left the topic and
been removed from the client by then, and it is never joined again.

## What is the new behavior?

`_resubscribe()` now:

- waits for the leave to finish (reply, error or timeout),
- re-registers the channel on the client and creates a fresh join push,
so earlier subscribe callbacks are not called twice,
- subscribes again with the callback given to the first `subscribe()`,
- runs once when several presence callbacks are added in the same tick.

`unsubscribe()` behaves as before. It now delegates to a private
`_leave()` that returns the leave push.

## Additional context

Tests are in `src/realtime/tests/test_resubscribe.py`. They use a mocked
WebSocket that acknowledges joins and leaves. Without the change, the
tests fail because the second `phx_join` is never sent. With it they
pass.

Fixes #1684


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Adding the first presence callback to an already joined channel
enables presence through an automatic resubscription. If the connection
drops during the process, the channel rejoins with presence enabled when
it reconnects.
* **Bug Fixes**
* Additional presence callbacks no longer trigger unnecessary
resubscriptions when presence is already enabled.
* Resubscription waits for the channel to leave before rejoining and
stops if the operation is no longer active, including when the channel
is unsubscribed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Lukas Kli... (continued)

831 of 858 relevant lines covered (96.85%)

0.97 hits per line

Source Files on job run-ubuntu-latest-3.11-supabase - 41633202749.3
  • Tree
  • List 20
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 41633202749
  • 697170cd on github
  • Prev Job for on main (#41632975450.23)
  • Next Job for on main (#41634096736.13)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc