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?