We have a chat application, we want to check to see if a specific Member ID is online to chat. I can only find information on getting a current Member ID to check to see if they are online. Is there a way to find a specific member id and see if they are online.
As far as I know there is no built-in functionality for this. It also depends a lot on what your definition of being online is. That the member has the page actively open, or that the member has recently opened a page?
For real-time things like chat applications I would rather use websockets I think. Or another solution could be to use ajax to call a controller every x seconds that does something with the memberid, such as caching it in a list and clear the ones that have not been active since a while.
Hi
Yeah some sort of keep alive ping would be a good solution here. Although you might need to get permission from the user before you capture this info.
Then if you have a table of ids and last ping datetime you can get an idea of who is or was recently online. You can clear this table of people who haven’t been online in the last however x many minutes to stop it getting bloated
Check to see if a specific member id is online
We have a chat application, we want to check to see if a specific Member ID is online to chat. I can only find information on getting a current Member ID to check to see if they are online. Is there a way to find a specific member id and see if they are online.
Is this something that Member Services can do?
Thanks
Hi Matthew and welcome to Our
You will be able to find the member by ID. See this link for reference
https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Core.Services.IMemberService.html#UmbracoCoreServicesIMemberServiceGetByIdSystemInt32
/Dennis
Dennis:
Would we be able take that Member ID then and check and see if that Member ID is online?
Thanks for the quick reply.
You can check if a user is online using code similar to below
You are welcome Matthew
You can find differens Umbraco helpers here https://our.umbraco.com/documentation/reference/querying/umbracohelper/#working-with-members there are different once, some of them are for members
Hope this helps,
/Dennis
Yep, that it always help :D
Hi Matthew,
As far as I know there is no built-in functionality for this. It also depends a lot on what your definition of being online is. That the member has the page actively open, or that the member has recently opened a page?
For real-time things like chat applications I would rather use websockets I think. Or another solution could be to use ajax to call a controller every x seconds that does something with the memberid, such as caching it in a list and clear the ones that have not been active since a while.
Best regards,
iNETZO
Hi Yeah some sort of keep alive ping would be a good solution here. Although you might need to get permission from the user before you capture this info.
Then if you have a table of ids and last ping datetime you can get an idea of who is or was recently online. You can clear this table of people who haven’t been online in the last however x many minutes to stop it getting bloated
is working on a reply...