Online Or Not
when you make a repl as a collaboration or team repl, it has a chat feature. In that chat feature, it shows if the user is available(online) or left(offline). I want to know how to do this.
the way replit does it is it detects if the user has closed the repl tab, or still has it on. I would like to know how to do this.
I don't know which languages can do this functionality, but whatever languages you can do it in. I would prefer it to be either: JS or Django.
both technically, but not exactly.
I don't believe django does have the option to do websockets, but I do know flask (similar to django) does.
But you are kind of overthinking this. Once you implement accounts, you don't need to know if the user closed the tab or not, when they connect to the websocket, all information is given!
@Coder100 by accounts, do you mean logging in and logging out?
If yes, then that wouldn't work. For now, I got how to check if a user is online, but when the user closes the tab without logging out, it still marks the user as online, but i want to changed to offline. So in replit, it works.
I am asking how to do that.
But if you want an alternate, i guess you could also detect if the user has closed the tab. so that way, you could mark the user as offline.
But do you have any ideas?
- there is a method called socket.disconnect that tells you
- why would users not work? You could just do like a socket.emit with all the user data you have stored in the cookie -- if you could display the username, that will suffice for our socket.emit, the backend can do the rest.
@Coder100 i don't really have an option for which language. You can choose whatever is ideal for you. But could you try doing it in django and js? I'll choose which is best. But it's your choice though. Whichever you may like.
Aso for the part, I don't really know which works properly, so please choose the best one.