Most of the blogs and stacks suggests below database for chat.
message_table
-id
-message
-conversationId
-sender
-receiverId
conversation_table
-id
-conversationId
Now message_table
look like this.
So, for the chat screen I subscribe the message table.
final mySubscription = supabase
.from('message_table')
.on(SupabaseEventTypes.all, (payload) {
// Handle realtime payload
})
.subscribe();
if user1 and user2 are chatting, they will get all messages from this table.
So, how to filter this data with specified conversationId in supabase to stop receive the other message of other users and for reduce of bandwidth ?
And Is this database viable ?
2
Answers
Finds all rows whose column satisfies the filter.
You can add eq filter on your realtime listeners like this:
supabase-flutter v1.X
supabase-flutter v0.X
You can read more about this feature on the official Supabase documentation here!