SupabaseS
Supabaseโ€ข4y ago
adarsh1021

Realtime event callback does not fire, but events are received in websocket messages

Hello! I have a very simple NextJS + Supabase setup, and I want to use the realtime feature to watch changes to a table.
Here is what I have:
useEffect(() => {

    const mySubscription = supabaseClient
        .from("item")
        .on("*", (payload) => {
          console.log(payload);
        })
        .subscribe();
    }

    return () => mySubscription.unsubscribe();

}, []);


The issue is that the callback does not fire - there is nothing on the console. But I can see every event received when I check the websocket messages through my inspect tools.

I am pretty new to Supabase, was trying to get something working for the #hackathon . I feel like this is something very small I am missing, any help would be greatly appreciated! Thanks ๐Ÿ™‚
Was this page helpful?