GithubHelp home page GithubHelp logo

Comments (4)

mman avatar mman commented on September 26, 2024 1

From what I could see, I believe the params exist only to workaround problematic behaviour of GCM, and I can imagine a client side workaround in the SDK. But anyway, here we are, so the sooner we investigate/confirm that FCM behaves sanely, and the sooner we release updated Android SDK, the better... for the cleanup of SDK and Push Adapter.

Additionally I can imagine a fix where we can actually lift the push_id and time away from the push adapter and let it be passed as part of request data into Parse.Push.send with parse server 8. That way people like me, who care about old Android installations that will not get updated ever... can still send compatible pushes... by adjusting their payload passed to Parse.Push.send...

from parse-server.

parse-github-assistant avatar parse-github-assistant commented on September 26, 2024

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

from parse-server.

mman avatar mman commented on September 26, 2024

Dropping this here as my initial investigation:

When a push is received in an Android app using official Parse Android SDK, the message is handled by the FirebaseMessagingService.onMessageReceived method:

https://github.com/parse-community/Parse-SDK-Android/blob/a08c5d1594b3a083671b493804eb1970c1ce6441/fcm/src/main/java/com/parse/fcm/ParseFirebaseMessagingService.java#L20-L44

This method extracts push_id, data, time, and channel parameters.

channel was/is used for channel based push targeting, where clients can subscribe to given list of channels and automatically receive all pushes targeted to that channel.

data is JSON encoded everything and anything that you actually send via Parse.Push.send from the server side.

push_id, and time are then passed over to PushRouter.handlePush where they are double-checked to not be nil/empty.

https://github.com/parse-community/Parse-SDK-Android/blob/a08c5d1594b3a083671b493804eb1970c1ce6441/parse/src/main/java/com/parse/PushRouter.java#L105-L113

  1. If push_id and time are empty, the push is thrown away.
  2. If they are not empty, the push is stored into history, and then passed to Android BroadcastReceiver.

There is a comment atop of the PushRouter.java file explaining that history is needed essentially because duplicate pushes could be actually received when the push was being sent by the GCM.

  • For PPNS, we provide the last-seen timestamp to the server as part of the handshake. This is
  • used as a cursor into the server-side inbox of recent pushes for this client. - For GCM, we use
  • the history to deduplicate pushes when GCM decides to change the canonical registration id for a
  • client (which can result in duplicate pushes while both the old and new registration id are still
  • valid).

So in order to remove push_id and time parameters from the Parse Android SDK, we need to make sure that:

  1. FCM is never sending duplicate pushes to the same device.
  2. timestamp of last contact is not required by FirebaseMessagingService.

Once we verify these two are handled, we can simply drop them from the Parse Android SDK, along with the history, and start propagating updated SDK to the clients.

Later after some years we can remove them from the Parse Push Adapter, once we are sure that there are no clients expecting them.

The risk is that clients in the wild using old Parse Android SDK will stop receiving pushes - will start dropping pushes because of lack of push_id and time.

from parse-server.

mtrezza avatar mtrezza commented on September 26, 2024

Thanks for the investigation.

Sending these params can be off by default already in the next Parse Server 8 release. We should just make sure to offer the corrected Android SDK at the point.

We would have to check wether other Parse repos use these params. A quick org-wide search for these params on GitHub shows occurrences in the following repos:

  • Parse Android SDK
  • Parse Flutter SDK
  • Parse Dashboard
  • Parse Server Push Adapter
  • docs

from parse-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.