
I need to "listen" to account events responsively to update my UI when user sign in and out (so, when a session is created and deleted), but if i subscribe as guest, it seems events are never fired. Do you know another way to achieve to listen to login/logout events??

The best example of what I'm trying to achieve is to reproduce onAuthStateChanged
behavior from Firebase

Honestly, don't try to reproduce this from firebase. Build an app as if that wasn't a thing

I guess I will need to use some state management to avoid to call account.get()
in setInterval or something very ugly...

instead of that, i would call account.get() after creating a session and store that in your state management. that's it

Ok, I'll try this.
And just to be sure, that also mean this code cannot be used until the user is signed in?
appwrite.subscribe('account', async response => {
// do something
});

i wouldn't do that.
after deleting the session, clear the user from your state management. that's it

Ok, that make sense, but I wanted to give a try without using a store, only using Appwrite Javascript 🙂

that's fine too

Thank you 🙂

[SOLVED] How to subscribe account events as guest?
Recommended threads
- setup custom domain to appwrite but stil...
i just installed a Appwrite instance in my vps and i did all default otions exept the domain i have setuop its dns as A records pointing to my vps ip altho...
- 1.7.x Style issue in the migration page
I am not able to select what to migrate because of the styling... the checkboxes are not showing on any of the appwrite versions 1.7.x. I tried other browsers, ...
- Appwrite Sites: Max File Size
Hello, I am facing an issue on my self-hosted appwrite instance with Appwrite Sites. I already have a small vite web app built out that I want to deploy, and ...
