Search code examples
apigoogle-cloud-platformgoogle-nearbygoogle-nearby-connectionsgoogle-nearby-messages

Can you update a message on google nearby message API?


I have 2 simple questions that I did not find by reading the official documentation about google nearby message API https://developers.google.com/nearby/messages/android/pub-sub

If you publish multiple messages with the publish method (on the same instance of an app), the messages are saved as several different messages or are updated and overwritten (on cloud console)?.

Is it possible with the publish method to update a message?

I'm building an application where each user sees what others are posting, but I just need to know the most up-to-date data of each user, I don't need all the messages.

Thank you.


Solution

  • With PubSub, you publish message in a queue. Then you can't update or delete them, they are published.

    On the consumer side, the messages are usually distributed in the order, but without any guarantee. In each message, you have a published timestamp.

    In your use case, it could be interesting to keep in memory the userID and the latest processed timestamp. If you application is distributed, the best is to store these data in memorystore.

    Like that, when a message comes in

    • Either it is newer than the value in memory store and your process it
    • Or, it's older and your trash it.