Firebase Chat App - two people log-in or send a message at same instant


#1

I’ve created a Firebase Chat App and after a lot of sweat, tears, and missed sleep I’m nearly ready to release it.

I just have one huge problem left (I managed to solve the rest of them after a LOT of thinking / meditating).

If two users log-in or send a message at the same instant, each user ends up in a unique chatroom instead of being paired with each other, and only one of those messages is stored and updated via the “When Firebase1 Data Changed” block.

I am thinking of using the “append value” and “first removed” blocks.

However, they don’t seem to be working.

Does anyone know of any way to prevent this and ensure two users log in at the same time or both messages are stored and updated between the users?


#2

Hi @Dean_Artis,

I use TinyWebDB inseated of Firebase
And I have a way to do that.

You need Clock component to make it fires every second.
Put under Timer event (Get value) with tag for example: UserID
If length a value > 0 then store it at variable and store empty value at same tag.

Now you got the value that stored at Variable