flutter_supabase_chat_core
flutter_supabase_chat_core copied to clipboard
Create new postgres function and trigger for publishing message events
What does it do?
Added a new postgres function chats.send_push_notification()
and trigger to publishes events to pg_notify
so that listeners (ie, supabase edge functions) can respond (ie sending a push notification to a user or device). It sends an event for each user that is in a room except the author.
Why is it needed?
I need to implement offline notifications for the app I am building. I could use a background listener on my app to listen for events on the messages table, however this doesn't work if the app is closed or suspended in the background.
How to test it?
- Apply the migration
- Create a listener on the
chat_push_notification
postgres channel - Send a message
- Observe that there are N-1 messages created on the channel, one for each of the members that wasn't the author.
Related issues/PRs
N/A