I am using yjs as the collarborate coordinator, now I found it is hard to debug, the communication use binary stream, it is hard to know the communication progress and content when facing issue. is there any suggestion?
I generally just log from the on('update')
and .observe
handlers to see what’s going on. I haven’t had the need to examine the binary myself.
did you have any minimal demo, I am doing it like this:
wsProvider.on('update', (event: MessageEvent) => {
console.log("trigger update");
})
I also tried in ydoc update to read the websocket provider status, when the websocket disconnect, the status from websocket provider still shows connect is true:
ydoc.on('update', (update, origin) => {
try {
let current_connection_status = wsProvider.bcconnected;
if(!current_connection_status){
debugger
}
} catch (e) {
console.log(e);
}
});
You want wsconnected
, not bcconnected
. Broadcast channels are just for inter-tab communication.