How can I receive awareness changes on the server side using yrs-warp?

I’m in the process of building a WebSocket (CRDT) server using yrs_warp. My goal is to detect changes in awareness, process the values, and store them in the database.

I’m currently implementing this based on the example, but I’m encountering difficulties when it comes to receiving the sent values.

I don’t know rust at all, but it looks like yrs-warp uses the y-sync library to manage synchronization and awareness. Check out the MSG_AWARENESS tag id and the Message.Decode method to see how the Awareness object is decoded.

1 Like

I think you should encode & decode the messages yourself. The example is rather constrained in allowing customization. Just copy the awareness.rs and add the handlers around websocket connection yourself. Easier to add debugging as well. If you fail to receive values and you are sure doc is loaded & clients connected, it’s probably about sync steps not processed in proper order or client messages getting lost. Or doc update subscriptions getting dropped.

1 Like

Thanks for the reply!
I will try it out based on your comments.
If it works, I will share it with you.