Saving and Geting information with Firebase

Hi I, made this with the purpose of connecting the users between each other, creating and joining to “games” but it’s very important to block the user from the possibility of creating two games with the same key or joining two games with the same key too.

Can you give me a tip? Do you know how can I prevent this from happening? I tried to be as clear as possible, I hope you understand! Looking foward to your responses! Thank you very much!

answered here: