Replies: 2 comments
-
I don't think push notification should replace socket. Notification is for delivering not so important messages that are not important if users receive/read or not. While socket is needed to make the app work properly. Firebase doesn't keep the connection. When your server sends a message with Firebase, it asks a platform-level transporter (Android transport layer, ios APNS, webpush) to push a message to the client. The Firebase client SDK communicates with the transporter to know when the message comes and trigger your code. This explains better than I do https://firebase.google.com/docs/cloud-messaging/fcm-architecture. I'm now sure how the transporter work under the hood, but receiving messages is the transporter's duty not Firebase. When the app is killed, the transporter still works, it's a part of the operating system. The message still comes and displayed with/without your app running. On iOS the notification service will wake your app up to do extra stuff (if you have anything to do) then quit. On Android it a separate task from the main task. Your app doesn't keep connection. This explains better than I do https://rnfirebase.io/messaging/usage#background-application-state But, as I wrote above. Notification can't replace socket. They're different things for different purposes. If it's a dead end, I'd think of the necessity of keeping connection. |
Beta Was this translation helpful? Give feedback.
-
This really seems like something to discuss on stackoverflow with the apropriate firebase tags (to attract the google firebase team, for a good discussion) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys,
i'm thinking of using FCM. My current stack is Expo and Supabase. But no matter what stack and tech i use [previously Graphql / Apollo] the websocket connection is dropped on mobile devices in favour of reserving battery life etc.
https://rnfirebase.io/messaging/usage#foreground-state-messages
here it states that messages can be received in the foreground when the app is active [in foreground]
so how good is firebase in keeping the connection running, i assume the subscription disconnects when the app goes to background or when killed. So when the app is brought to the foreground or reopened, does the subscription reconnect itself seamlessly? is there any issues with this?
Beta Was this translation helpful? Give feedback.
All reactions