sunny-green
sunny-green6mo ago

A similar graphqlLiveProvider for REST?

Hello everyone, While working on a refine project, I was wondering if there is something similar to graphqlLiveProvider for RESTful APIs that allows real-time updates? Thank you in advance, everyone!
2 Replies
kapa.ai
kapa.ai6mo ago
Hi @M3HDI. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Refine provides a liveProvider prop for the <Refine> component that enables real-time features in your application. This feature allows you to subscribe to changes in the data and update the UI accordingly. It also allows you to publish changes to the server to notify subscribers. However, the liveProvider is not specific to REST or GraphQL. It's a general feature that can be used with different solutions like Ably (https://ably.com), Socket.IO (https://socket.io/), Mercure (https://mercure.rocks/), supabase (https://supabase.com), etc. Here's an example of using Ably with refine:
import { liveProvider, Ably } from "@refinedev/ably";

const ablyClient = new Ably.Realtime("your-api-key");

const App = () => {
return (
<Refine
liveProvider={liveProvider(ablyClient)}
options={{ liveMode: "auto" }}
/* ... */
>
{/* ... */}
</Refine>
);
};
import { liveProvider, Ably } from "@refinedev/ably";

const ablyClient = new Ably.Realtime("your-api-key");

const App = () => {
return (
<Refine
liveProvider={liveProvider(ablyClient)}
options={{ liveMode: "auto" }}
/* ... */
>
{/* ... */}
</Refine>
);
};
You can refer to the Realtime documentation (https://refine.dev/docs/advanced-tutorials/real-time/) for more information about refine's realtime features. Please note that the real-time updates can work with the data hooks of refine without any additional configuration. Sources: - Realtime documentation (https://refine.dev/docs/advanced-tutorials/real-time/) - React-admin vs Refine - Which React Framework is Best for B2B Apps? (https://refine.dev/blog/react-admin-vs-refine#realtime) - Refine Component Documentation (https://refine.dev/docs/core/refine-component#liveprovider) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6mo ago
<@751100082274828380> kapa.ai is still learning and improving, please let us know how it did by reacting below