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

Multi-Device Notification Synchronization: Streamlining FCM and Apptoken Handling for a Seamless User Experience #28

Open
gkatrakazas opened this issue Oct 16, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@gkatrakazas
Copy link
Member

In our ongoing efforts to provide users with a seamless and consistent experience across multiple devices, we are excited to introduce an innovative approach to managing Firebase Cloud Messaging (FCM) tokens and apptokens. This enhanced system ensures that notifications are delivered accurately and efficiently to the right devices while respecting user preferences.

Array of FCM Tokens and Apptokens:
Traditionally, managing FCM tokens for user notifications involved storing a single token associated with each user. However, with the rise of multi-device usage, this approach presented challenges. Users now expect notifications to seamlessly transition across devices as they interact with our application. To address this, we have developed an array-based approach.

During Signup and Login:

  • FCM Token Generation: When a user signs up or logs in from a new device or browser, we automatically generate a new FCM token for that specific session.
  • Apptoken Creation: Simultaneously, we generate a unique app-specific token (apptoken) for the user's device or browser session.
  • Array Storage: Both the newly generated FCM token and apptoken are then added to an array of tokens associated with the user's profile. This array acts as a repository for all tokens related to the user's devices and sessions.

Logout and Token Management:

  • Token Removal: Whenever a user logs out or a token becomes invalid (e.g., due to expiration or device/browser removal), we promptly remove the corresponding FCM token and apptoken from the user's token array.

Sending Notifications:

  • Array Iteration: When we send notifications, we iterate through the array of FCM tokens and apptokens associated with the user.
  • Efficient Delivery: Notifications are sent to all valid tokens present in the array, ensuring that notifications reach all devices and browsers the user has used our application on.

Frontend Handling:

  • Conditional Display: On the frontend, we implement a condition check to determine if the apptoken exists in the user's cookies before displaying notifications.
  • Personalized Experience: If the apptoken is present, notifications are displayed, guaranteeing they are shown exclusively on personal devices where the user is logged in.
@gkatrakazas gkatrakazas added the enhancement New feature or request label Oct 16, 2023
@kkmanos kkmanos transferred this issue from wwWallet/wallet-frontend Oct 16, 2023
kkmanos pushed a commit that referenced this issue Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant