Replication of data in Yjs

Hello, I am trying to know how Yjs replicates the data. So far I understood that , using webRTC peer to peer replication is done , whereas using y-websocket Active-passive (master-slave ) replication is done. My question is, is there possibility of active-active/ multi-leader replication in yjs ?

There are no “Leader/Followers” or “Active/Passive” peers in Yjs. Every peer of a Yjs document is a “Master” replica - even if you use y-websocket.

The different providers just build different networking topologies. But you could also use multiple y-websocket and y-webrtc providers in combination. Yjs guarantees that eventually all connected peers sync up.

The sync protocol is quite simple. Basically, all peers sync up once they shared all “update” messages + it is okay to receive the same update twice. You don’t have to think about conflict resolution. You can read more about the update exchange here: https://docs.yjs.dev/api/document-updates