useful-bronze
useful-bronze2y ago

what's the best way to check status/debug live provider updates? (MUI/Supabase)

I am using the builtin live provider and having very intermittent success with live events showing up. I fully updated and upgraded to newest release and have switched between manual and auto to try and debug, but I cannot really figure out how to figure out if the live connection is active.
Has anyone else had issues with these working consistently?
8 Replies
kapa.ai
kapa.ai2y ago
Hi @hortinstein. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai
kapa.ai2y ago
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, I can provide you with some information on how to work with the live provider in refine. Refine allows you to add real-time support to your app using the liveProvider prop for <Refine> (https://refine.dev/docs/api-reference/core/components/refine-config/). It remains agnostic in its API to allow different solutions like Ably, Socket.IO, Mercure, Supabase, etc., to be integrated. A live provider must include the following methods:
const liveProvider = {
subscribe: ({ channel, params: { ids }, types, callback }) => any,
unsubscribe: (subscription) => void,
publish?: (event) => void,
};
const liveProvider = {
subscribe: ({ channel, params: { ids }, types, callback }) => any,
unsubscribe: (subscription) => void,
publish?: (event) => void,
};
You can find more information about creating a live provider and its methods in the live provider documentation (https://refine.dev/docs/api-reference/core/providers/live-provider/). If you're still experiencing issues, I recommend checking out the real-time advanced tutorial (https://refine.dev/docs/advanced-tutorials/real-time) and the Ably live provider example (https://refine.dev/docs/examples/live-provider/ably) for more guidance on setting up and troubleshooting real-time features in refine. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Live / Realtime | refine
refine lets you add Realtime support to your app via the liveProvider prop for ``. It can be used to update and show data in Realtime throughout your app. refine remains agnostic in its API to allow different solutions(Ably, Socket.IO, Mercure, supabase, etc.) to be integrated.
Ably | refine
The liveProvider is a powerful tool for developers who want to create an interactive app experience that can be updated in Realtime. This is an example of refine that you can use to manage your data in Realtime.
kapa.ai
kapa.ai2y ago
<@169298166506586113> kapa.ai is still learning and improving, please let us how it did by reacting below
flat-fuchsia
flat-fuchsia2y ago
Hı @hortinstein, can you give me more detail about your question ? i'm not quite understand. But in short, live-provider works like this:
1. subscribe to postgres changes
https://supabase.com/docs/guides/realtime/extensions/postgres-changes
2. if changes happened, invalidate the resource
1. subscribe to postgres changes
https://supabase.com/docs/guides/realtime/extensions/postgres-changes
2. if changes happened, invalidate the resource
useful-bronze
useful-bronze2y ago
Thanks! Ok that makes sense, unfortunately it seems to not work very often, this might be a supabase issue. It doesn't appear to establish a connection to the changes everytime. I will try to write my own provider and debug
flat-fuchsia
flat-fuchsia2y ago
thank you, please let us know 🙏🏻
useful-bronze
useful-bronze2y ago
Yeah if I find anything interesting I'll submit a PR. Just looked at the live provider code for supabase here https://github.com/refinedev/refine/blob/master/packages/supabase/src/liveProvider/index.ts and seems super straightforward, (nice API design!) As always thanks for the excellent support!
GitHub
refine/index.ts at master · refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/index.ts at master · refinedev/refine
flat-fuchsia
flat-fuchsia2y ago
I'm glad to hear that 🥹 thank you