[SOLVED] useMoralisSubscription not working

Iā€™m trying to get the records from a table in real time, but I only get the data once on page load, useMoralisSubscription is not detecting when I add new records, what could I be doing wrong?

  const { data: notifications, error: notificationsError, isLoading: notificationsLoading } = useMoralisQuery(
    "Notifications",
    query => query,
    [],
    {
      live: true,
    },
  );

  useMoralisSubscription('Notifications', (q) => q, [], {
    onUpdate: (data) => {
      console.log(data);
    },
    onCreate: (data) => {
      console.log(data);
    },
    onEnter: (data) => {
      console.log(data);
    },
    onLeave: (data) => {
      console.log(data);
    },
  });

is this for a self hosted server or for a moralis server?

it is a self-hosted server

maybe this helps then:

This helped me - thanks so much.

1 Like