Y-supabase: Too many message events

I’m trying to use supabase realtime as my server solution to yjs, I’ve found this not so maintained supabase provider GitHub - AlexDunmow/y-supabase: Supabase Provider for Yjs

I had some difficulties setting it up but my question is that is it normal for this provider to broadcast too many messages even when none of the clients are doing any actions or typing or firing any event.

This photo may not be familier to those who doesn’t use supabase

But it shows many Broadcast’s (like websocket emit’s) in a very short time that aren’t caused by client activities.

I’m not sure if this accounts for all of the messages you are seeing, but it is normal for Awareness messages to continue firing without user interaction. They keep the connection open and provide presence data to other clients.

You may want to open an issue on the provider repo in case this is specific to y-supabase.

Here is an image that represents the situation better

By the way, I am using slatejs (a text editor library), and even though the user didn’t type anything, there have been many message broadcasts other than the awareness ones

Also How can I learn more about the data being transferred? I mean the payload like: [1, 274, 175, 138, …]

I am thinking that there are some problems caused by the provider logic, but I am not sure; hence, I don’t know much about creating a yjs provider. ( I would appreciate any resources about this )

The payload is binary encoded, and how it is structured depends on what type of message it is. In this case, that is the payload for an awareness update probably encoded with awarenessProtocol.encodeAwarenessUpdate(...). I’m noticing that most of the broadcast messages in your screenshot have an empty payload for some reason.

Binary data in YJS is ultimately encoded/decoded with lib0/encoding and lib0/decoding, though I would recommend trying to debug the provider at a higher level.

I would highly recommend opening an issue on the y-supabase repo. Also the owner has their email listed in the README.

The source code is a single file of ~284 LOC.

y-websocket is probably the best example of a fully functional networking provider that can be used as a model. Creating a custom provider is still a very low-level activity. It’s too bad we don’t have storage provider and network provider superclasses to use as a starting point.

Maybe use partykit and plug supabase in from there ?