My attention is to get logged in ( online user list). how this is possible as appwrite server sdk is not ready for realtime yet.
Logging in does not translate to "online users"
What so you mean? So when I subscribe to account channel! It returns session is not valid
So can we get something like userId of logged in user!
I understand other security related info cannot be received!
Please be as informative as you can. As your original post does not really explain anything. When a user signs in, that user receives a session object. How do you define "online user" in this context?
How does your approach look like? What is your code? You have to provide a lot more information than that
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');
client.subscribe('account', response => {
// Callback will be executed on all account events.
console.log(response);
});
``` based on the document, I. could use real time to subcribe to account channel, so whenever user create session ( login) it would return to the subcriber! my intension is to collect those user id having the sessions (login) . then in the system can identified them as online or active.
In appwrite functions you are supposed to use the event trigger https://appwrite.io/docs/advanced/platform/events
Also the user can stop the app in the meantime. So not sure what you mean with "online" and "active"
Just because the user logged in at some point does not nessecarily mean that the user is online as long as the session is active
user should be considered active until it left broswer
And how are you going to know when it leaves?
if I use nextjs, onroot layout component disposed, trigger to remove from the collection. then all subcriber should be notified
the workaround solution for this I could think of is creating separated collection UserActive , and when user login -> manually update add userId to the collection then giving real time subcription to that collection! however, i see there is way to subcribe to 'account' channel, which should be more appropriate
Recommended threads
- education plan not activated
Hi I have an edu id 13103046@iubat.edu but when I am trying to claim my plan and trying to logging with github where education student plan active. the appwrite...
- I'm getting an error on the console "j?....
On my self hosted instance version 1.8.1 the console is giving me this error when trying to view the rows for a table I recently created. My application is read...
- 500 simultaneous OAuth logins from the s...
Hi, I'd like to ask about rate limiting around Google OAuth login on Appwrite Cloud. **OVERVIEW** Service type: A PWA (web app) for members of a university clu...