Pergunta

How can a receiver of a GCM message detect if the message has been "collapsed" by the GCM server using a collapse_key? Is there any feedback available? or best practise?

The goal is to create a optimal (cheapest) implementation for the "send_to_sync" pattern where the client only "syncs" if there are messages missed.

Example: Let's say a group of 10 devices updates each other on their exact location trough GCM messages. Only the latest update is relevant, so it would be nice to have each user have its own collapse key. Because of the limit of 4 collapse keys when using GCM you can not use a collaps key per user, thus you have to create your own system and use the "send_to_sync" pattern. It would be nice if every "send_to_sync" message contained the latest update + in indication if there are any missed messages, if not, then there is no need to sync.

Foi útil?

Solução

The receiver can detect that a message has been collapsed by including some sort of counter in the payload. Each time the server sends a GCM message to the devices, it would increase that count by one. When a device receives a message, it would compare that count to the previous count it received. If the count grows by more than one, a sync is required.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top