Subscription Filter

Hello Team, I tried filtering the subscription, but it doesn’t work. Maybe we could add this feature, in this way, the user will only subscribe based on his account and will not receive from all the other transactions happening in a specific table.

const query = new Moralis.Query("Notification");

  query.equalTo("owner_of", ethAddress)

  const querySubscription = await query.subscribe();

  querySubscription.on("create", (notification) => notifyUser(notification, ethAddress));
1 Like

Hi @appsofdave

Jst tested this - it worked for me. Check if the subscription is opened:

const query = new Moralis.Query("Test")
query.equalTo("owner_of", ethAddress);
const querySubscription = await query.subscribe();
 querySubscription.on("open", () => {
        console.log("subscription opened");
 });

querySubscription.on("create", (notification) =>
    console.log(notification, ethAddress)
);

If you will set ACL for the specific user only you will see in the querySubscription only new objects with user’s ACL

2 Likes

Thanks for helping out, I’m not sure why it’s not working for me.

I used 2 accounts on different browsers. Whenever I do a follow on the first browser, the second one will still receive the notification even though the data that entered the table is not for the second user.