Skip to content

Conversation

@SteffenDE
Copy link
Contributor

Relates to: https://elixirforum.com/t/handling-channels-liveview-longpoll-fallback-unmatched-topic/72378

On mobile Safari (e.g. iOS) the following could happen when using LongPoll:

  1. user connects to a channel
  2. device goes to sleep
  3. Phoenix shuts down long poll server
  4. client connects again, server responds with 410
  5. LongPoll continues as usual, but channels are not joined any more
  6. client sends messages for previous channel
  7. channel errors with "unmatched topic" but does not rejoin

We handle this by checking if we already have a LongPoll token when receiving a 410 code and instead trigger an error which will cause a proper rejoin.

Relates to: https://elixirforum.com/t/handling-channels-liveview-longpoll-fallback-unmatched-topic/72378

On mobile Safari (e.g. iOS) the following could happen when using LongPoll:

1. user connects to a channel
2. device goes to sleep
3. Phoenix shuts down long poll server
4. client connects again, server responds with 410
5. LongPoll continues as usual, but channels are not joined any more
6. client sends messages for previous channel
7. channel errors with "unmatched topic" but does not rejoin

We handle this by checking if we already have a LongPoll token when
receiving a 410 code and instead trigger an error which will cause a
proper rejoin.
@SteffenDE SteffenDE merged commit 12fb217 into main Nov 19, 2025
12 checks passed
@SteffenDE SteffenDE deleted the sd-channel-410 branch November 19, 2025 18:15
filipecabaco pushed a commit to supabase/phoenix that referenced this pull request Nov 26, 2025
* treat 410 as error if we already have a token

Relates to: https://elixirforum.com/t/handling-channels-liveview-longpoll-fallback-unmatched-topic/72378

On mobile Safari (e.g. iOS) the following could happen when using LongPoll:

1. user connects to a channel
2. device goes to sleep
3. Phoenix shuts down long poll server
4. client connects again, server responds with 410
5. LongPoll continues as usual, but channels are not joined any more
6. client sends messages for previous channel
7. channel errors with "unmatched topic" but does not rejoin

We handle this by checking if we already have a LongPoll token when
receiving a 410 code and instead trigger an error which will cause a
proper rejoin.

* add unit test
@jtbayly
Copy link

jtbayly commented Dec 15, 2025

For the record I was seeing this on MacOS 26.2, also. Thanks for the fix!

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.

4 participants