FeatureFuel
2

Realtime Subscription on database changes API could be better

Source: supabase/supabase#14268 · opened by @talamaska
I find the implementation confusing, very far from how dart streams work. Having the following code for listening for inserts from a table.
I inspected the underlying implementation and as suspected it is based on websockets. That's great. WebSockets in dart normally expose a Stream. I totally get why we have to set the channel name. But the whole structure seems somehow unfriendly. Also I'm no sure how can I limit what kind of data I want to receive. Like I have to filter the result in order to make sure it is for the current user. but that's another story. I would suggest another better on my subjective view API surface, base on dart streams.
Original Code




Suggested




Edit: I haven't though about the possibility to have multiple subscribers to one channel. This is done the StreamController<Type>.broadcast();
Thus canceling a subscription should not close the channel if it is on a broadcast stream

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests