Synchronization of conversations between multiple tabs

About https://github.com/GladysAssistant/Gladys/pull/1051
which fixes Spread own chat messages to other opened window of the same user (websocket) · Issue #553 · GladysAssistant/Gladys · GitHub

I think we need to discuss a bit more before fixing :slight_smile:

I had imagined this sequence diagram to solve the problem but the story of IDs is a bit confusing. The IDs generated by the Front and those of the database have nothing to do with each other.
It is the Front that initiates the message that must know which message it has sent (to avoid duplicates when the back distributes this same message to all the fronts to synchronize them).

Do you see another approach?

I agree, it’s better to discuss this :slight_smile:

That’s the problem, in my opinion we could generate an ID on the client side and use the same ID on the DB side :slight_smile: that would solve the problem, right?

I’m not used to generating base IDs on the Front side, but it would indeed solve the problem. Since it’s UUIDV4, it’s fine (no collisions and it can be generated from the front).

It’s quite common in systems like this, where states need to be synchronized in different places (multiple clients, server, DB), to generate a UUID on the client side, which allows identifying a resource end-to-end :slight_smile: