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
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.
Comments
Similar requests
Make Changes to the DB through a Realtime extension
2 votes · 0 comments
NoSQL (Document) Database Alternative?
1 vote · 0 comments
Individual NPM packages for supabase-js modules?
2 votes · 0 comments
Add "status" column in subscriptions stripe to where filter "status" works outside of attrs
2 votes · 0 comments
Ability to enable Realtime on Storage objects table
1 vote · 0 comments
No comments yet.