Rank 4: Virtual Machine
My attention is to get logged in ( online user list). how this is possible as appwrite server sdk is not ready for realtime yet.
Votes
0
Replies
14
Participants
Unknown
Messages
15
Rank 4: Virtual Machine
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"
Rank 4: Virtual Machine
What so you mean? So when I subscribe to account channel! It returns session is not valid
Rank 4: Virtual Machine
So can we get something like userId of logged in user!
Rank 4: Virtual Machine
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
Rank 4: Virtual Machine
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
Rank 4: Virtual Machine
user should be considered active until it left broswer
And how are you going to know when it leaves?
Rank 4: Virtual Machine
if I use nextjs, onroot layout component disposed, trigger to remove from the collection. then all subcriber should be notified
Rank 4: Virtual Machine
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