realtime-csharp
realtime-csharp copied to clipboard
Realtime Events not respecting options
In my options, I am listening only for Updates.
TestChannel = client.Realtime.Channel($"MyChannel-{parentID}")
TestChannel.Register(New PostgresChangesOptions("public",
"TestData",
PostgresChangesOptions.ListenType.Updates,
$"parent=eq.{parentID}"))
Await TestChannel.Subscribe
However, I am also receiving Inserts and Deletes.
Also, the Delete messages received do not correlate to my filter. Every single client gets every single delete even when the delete is for a different parentID.
Reproduction Steps
Click "Insert Subscribed Row" - The Insert event is fired Incorrect as I'm listening only for updates Click "Insert Random Row" - No event fired Correct
In Supabase studio.
Edit one of the random rows (X=1,Y=1) No event fired Correct Edit one of the subscribed rows (X=99,Y=99) Update Event fired Correct Delete one of the subscribed rows Delete Event Fired Incorrect as I'm not listening for deletes Delete one of the random rows Delete Event Fired Incorrect as I'm not listening for deletes AND I'm not subscribed to those records
https://github.com/Kuffs2205/TestRealtime.git
I'm up to 10,000,000 messages this month. I queried this as it seemed excessive. Now I see the Delete issue, it makes sense.
I wasn't sure if I should post the url and key publicly so I didn't but I can give it you if you want it.
Thanks for the report @Kuffs2205 - As this library is modeled off of realtime-js, went there to attempt to reproduce. I was able to reproduce the same issue on @supabase/[email protected] with the delete filter not being respected. We'll see what they have to say!
Thanks for taking a look. I'm never quite sure if it's just me with a poor understanding or not.
Looks like this is a limitation known by the team at realtime - filters on delete events are currently unsupported. I'm going to keep this open to track it! (See the referenced issue)
So filters do not work at all then as PostgresChangesOptions.ListenType.Updates still gives me Inserts and Deletes too.
This is not sustainable. Literally millions of messages being sent and charged that I do not want and my user base is not yet that big. Hope they sort it soon or at least document it better so people don't fall into the trap of paying for unwanted messages.
@Kuffs2205 unfortunately I'm just a volunteer library maintainer - but I absolutely agree with you. Maybe consider reaching out to supabase support about considering your account status and being charged for extra, unwanted events?
I wasn't suggesting you were at fault at all. Sorry if it seemed so.
No worries - just wanted to offer a course of action in the meantime!
Can I just clarify something as it seems that all the focus was the "eq" filter not working for deletes but there was another issue in that:
PostgresChangesOptions.ListenType.Updates PostgresChangesOptions.ListenType.Inserts
was also not being respected and all events were being returned regardless of what was asked for
Is this related or a separate issue?
🤦 I got caught up in the filter thing that I forgot to check the second part of your issue! Let me get back to you on that.
Okay, so I can confirm that there is a bug in the library's code. It is sending a request to subscribe to all events instead of respecting the options - so good catch there - I'll issue a quick fix for that - Thank you!!
However, I can also duplicate the same issue on the javascript library, where a postgres_changes listener is started with the expectation of only receiving UPDATE events, but the socket sends INSERT and DELETE events as well.
SO! You are correct. The library is not respecting the options (fix coming momentarily). But the websocket server sends events regardless (upstream issue that I also need to make another issue for)!
Thanks for checking that out. I really appreciate your efforts on this library. I wouldn't be using Supabase without it.