Td: Message ids aren't unique

Created on 18 May 2018  路  3Comments  路  Source: tdlib/td

The API docs states that message ids are unique:

cloudapp annotation 2018-05-18 at 11 09 54 am png

Although I just discovered that it's not true. Hence the question: how are they work? Are ids are unique to a chat or combination of a chat and a client? If I'd get the same message on a different client (an instance of TDLib) will message have the same id, or it will be completely different?

Here is an example of an incoming update:

cloudapp annotation 2018-05-18 at 10 59 28 am png

And here is a message stored in my DB:

cloudapp annotation 2018-05-18 at 11 08 24 am png

This is really confusing. Thank you in advance!

Most helpful comment

Yes, all message identifiers are defined inside a chat and they are unique only for that chat.

If you'd get the same server message on a different client for the same user, then message will have the same id. This is not true for local messages and for messages received by different users.

All 3 comments

Ok. I've found another doc where it clearly states that the message id is unique to the parent chat.

cloudapp annotation 2018-05-18 at 1 59 45 pm png

Yes, all message identifiers are defined inside a chat and they are unique only for that chat.

If you'd get the same server message on a different client for the same user, then message will have the same id. This is not true for local messages and for messages received by different users.

@levlam thank you for the clarification!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liaoyu1992 picture liaoyu1992  路  4Comments

IRGC picture IRGC  路  4Comments

joshchernoff picture joshchernoff  路  5Comments

mossaudi picture mossaudi  路  3Comments

mbj2007 picture mbj2007  路  4Comments