I'm implementing messages on an application (not realtime messages), and I have all the sending and receiving set up, but I'll make things a lot easier if I could generate unique id's for the messages before sending them to the server.
So because the id is generated before reaching the server, I can't know the other id's in order to make a new one. I could use a random string or something, of course the problem is that it's possible that sometime one of the id's repeats. But how do I make sure that that is very unlikely and it's not a gigantic string.