forrealtime

RealtimeProvider

Opens a shared EventSource connection for your component tree.

RealtimeProvider opens one shared EventSource connection for all channels used anywhere in its subtree. Place it high in your component tree — typically at the root or layout level.

import { RealtimeProvider } from "forrealtime/client";

export function App({ children }: { children: React.ReactNode }) {
  return (
    <RealtimeProvider api={{ url: "/api/realtime" }}>
      {children}
    </RealtimeProvider>
  );
}

Props

PropTypeDescription
api.urlstringURL of your SSE endpoint

On this page