Skip to content

Missing messages on Chat for Web when tab frozen #2888

Description

@tonyo-vetai

Which packages are you using?

stream_chat_flutter

On what platforms did you experience the issue?

Web

What version are you using?

10.1.0

What happened?

Possible to miss messages on web whilst the tab is frozen.
This is seen most often on Android Chrome, but it is possible to replicate on Desktop using "chrome://discards" and freezing the tab.

The only way we have been able to stop this is onResume of the chat window we then listen to the Channel with the following code.

useOnAppLifecycleStateChange((from, to) {
      if (to == .resumed) {
        // Watch the channel, but ignore. Fixes chrome tab freeze and then return
        // not receiving messages
       client
            .channel('messaging', id: channelId)
            .watch()
            .ignore();
      }
    });

Steps to reproduce

1. On Android device (Android 16+)
2. Join a chat, receive messages as normal
3. Turn the screen off
4. Send more messages from the other user, over a time period of around 1 min
5. Unlock the device, back into the Chrome tab
6. Missing messages.

If you close and re-open you will get the messages. All reconnection works fine as can be seen in the logs.

Supporting info to reproduce

No response

Relevant log output

Flutter analyze output

Flutter doctor output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions