Skip to content
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

fix: undelivered background data message ios #4144

Merged

Conversation

compojoom
Copy link
Contributor

Description

This should be viewed as a temporary fix.
A lot of people are reporting that the background data messages on iOS are not being delivered. The app wakes up, but the background listener doesn’t receive the message. Some apps that have a lot of JS apparently need more than the 2s timeout to be ready. So what happens is - app is started, 2s elapse, RNFBMessaging sends the message to the js handler, but the JS handler is not ready yet and misses the message. We mitigate this by delaying the delivery of the message to the JS side.

This solution however is not optimal becasue we are sending a completionHandler after about 25s which means that our JS code would have only 16 to do something with the data message.

A correct fix would be to figure out how to dispatch the message once the JS side is actually ready.

Related issues

#4104

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

This should be viewed as a temporary fix.
A lot of people are reporting that the background data messages on iOS are not being delivered. The app wakes up, but the background listener doesn’t receive the message. Some apps that have a lot of JS apparently need more than the 2s timeout to be ready. So what happens is - app is started, 2s elapse, RNFBMessaging sends the message to the js handler, but the JS handler is not ready yet and misses the message. We mitigate this by delaying the delivery of the message to the JS side.

This solution however is not optimal becasue we are sending a completionHandler after about 25s which means that our JS code would have only 16 to do something with the data message.

A correct fix would be to figure out how to dispatch the message once the JS side is actually ready.

invertase#4104
@vercel
Copy link

vercel bot commented Aug 26, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/invertase/react-native-firebase/qmkjlcqkq
✅ Preview: https://react-native-f-git-fork-compojoom-fix-iosbackgroundnotif-c6c592.invertase.vercel.app

@Salakar Salakar changed the title Temp fix: undelivered background data message ios fix: undelivered background data message ios Aug 26, 2020
@Salakar Salakar added platform: ios plugin: messaging FCM only - ( messaging() ) - do not use for Notifications labels Aug 26, 2020
@Salakar
Copy link
Member

Salakar commented Aug 26, 2020

Thanks! Will merge & publish once CI green

@Salakar Salakar merged commit 415dba4 into invertase:master Aug 26, 2020
hmhm2292 pushed a commit to hmhm2292/react-native-firebase that referenced this pull request Jul 13, 2021
A temporary fix until a better solution is implemented.
mikehardy pushed a commit that referenced this pull request Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ios plugin: messaging FCM only - ( messaging() ) - do not use for Notifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants