Realtime subscriptions not working

Hi, I'm trying to enable realtime subscriptions for one of my tables and my subscription status is always 'TIMED_OUT' when I try to do an insert. Here is my code. I have RLS enabled and realtime enabled for my pursuit table and I have this policy

alter policy "Allow insert for all"
on "public"."pursuit"
to public
with check (
true
);


Here is my realtime code.

useEffect(() => {
    console.log("Setting up realtime listener...");

    const channel = supabase
      .channel("pursuit-insert-channel")
      .on(
        "postgres_changes",
        {
          event: "INSERT",
          schema: "public",
          table: "pursuit",
        },
        (payload) => {
          console.log("New pursuit inserted:", payload.new);
          getPursuits();
        }
      )
      .subscribe((status) => {
        console.log("Realtime subscription status:", status);
      });

    return () => {
      supabase.removeChannel(channel);
      console.log("Realtime unsubscribed");
    };
  }, []);
Was this page helpful?