Forum Documentation Showcase Pricing Learn more

Online/offline best approach


I’m building a freelance platform. What is the best approach to setting a user offline or offline. I’ve tried states but it doesn’t work when you reload the page as the state is set by default to online. I want users to be able to set their status to invisible and remember that status.

I can do that with database value yes/no, but not sure what the best approach is.

1 Like

If you want the user to be able to change that for himself manually then I think a yes/no would suffice. Just set a data type under user called status or something. You can update that depending on what the user does. Unless you want to use a text and set it to Online/Offline and possibly something else in the future like Online/Offline/Unavailable/Available etc.

I hope that’s helpful. :+1:

If you are looking for when the user is actually online at the moment then I think there is a plugin that could help with that.


I wanted to avoid using the database where possible. I guess I will go for the yes/no option from the database.


It’s really the best way if you want to set something for each time that user logs in. :+1:


You could use a combo… the workflow would set a state and save to the database. When you load the page you would set the state by referencing the database.
I would say this is 99% of the time this is redundant redundant, but you get a little bit faster switching times by changing the state first.


There is also a plugin to detect inactivity, you could use this to set the user offline (and end the session) after 30 min. or so :slight_smile:


Set it on the Current user object so you don’t have to make additional read calls to the DB.

Another option is to set a cookie, but that is machine dependant. So if the user logs in another device you won’t have the last state available.

How are you planning on managing the offline status on browser/tab closing? I believe that is the difficult part of user presence in Bubble.