Hi! I am trying to check if an user if active or not through live queries and I hope Iām not using them wrong. When the connection is āopenā it works and shows that the user is active, however when the user logs out it still shows that heās active.I believe thatās when the connection should be āclosedā and the user activity should be marked as āfalseā
const query2 = new Moralis.Query("Contacts")
query2.equalTo("user", "bobo")
const result = await query2.first()
const subscription2 = await query2.subscribe()
subscription2.on('open',async()=>{
setUserdata(result)
result.set("isActive",true)
result.save()
console.log("subsctiption contact open")
})
subscription2.on('close',async()=>{
result.set("isActive",false)
result.save()
console.log("subscription closed")
})
Can someone please help me figure out what might be the problem?