tinode / chat

Instant messaging platform. Backend in Go. Clients: Swift iOS, Java Android, JS webapp, scriptable command line; chatbots
GNU General Public License v3.0
12.03k stars 1.88k forks source link

How to show list of online users by default? #66

Closed k0fi closed 6 years ago

k0fi commented 6 years ago

Hello, As users logs in, they encounter with a blank chat page and need to add user/groups, which is not very pleasant for a public chatroom were people don't necessary know who else are in the room. I'm wondering how can change tinode to show the list of available users (or a public default group) to them, as they log in?

Thanks for your quick replies.

or-else commented 6 years ago

Hi.

If I understand correctly, you want some sort of user discovery / social networking / find new friends feature. That's outside of the scope of the core project. The expected use case is that the user starts with uploading their contact list.

On the other hand you can auto-subscribe the user using plugin API. Add a handler for new account events then subscribe the new user to desired users or groups. You can implement any kind of logic in your bot.

or-else commented 6 years ago

You can also create a group, say "Users online", then auto-attach everyone to that group on login. It will work OK for a couple of hundred online users. It obviously won't work once you have a lot of users.

In general, this feature can work for small groups only. Otherwise it will become a full-fledged app on its own, like Badoo or Tinder.

k0fi commented 6 years ago

Interesting, I was almost disappointed that I can make use of tinode.... Will you please elaborate how to auto-attach everyone to a certain group "Users online" on login?

or-else commented 6 years ago

Just like I wrote before:

  1. Create a group, say "Users online". Save its ID (e.g. the address like grpAbC123)
  2. Either modify a client or use the plugin API to subscribe every new account to this grpAbC123 group.
  3. Display current users online in the group in the UI.

It's not out of the box functionality but it can be done.

or-else commented 6 years ago

Here is a CL which shows how to show users currently online in a topic:

https://github.com/tinode/example-react-js/commit/6a2681ab56581e517c65287617add8a00d7776ac

If you want to try it, use devel branches of the server & tinode-js.