List of users in current chat room

edited May 2015 in Photon Chat
Hello. How can i get the list of users in current chat room?


  • Hi, GLeBaTi
    it is not possible to get users list yet
  • Somehow it's possible, I was planning to write a topic about the same subject.

    I'm asking if there is any way to make it possible to somehow know the other clients "name" at least?

    1) I was able to create list of users by doing like this:
    When user subscribes -> OnSubscribed() -> if successful -> publish empty "" message to that subscribed channel -> other clients hear your message and add your name to a local variable.

    But there is one problem with that. I don't like using this method, because even if the message is empty it's stored inside the subscribed channel's Messages.

    In UI side you can always specify what user can type or not.

    2) I tried before 1) to make the new event, chatclient via server. I used same function structure as in ChatClient.cs and all, I used parameters, I converted data to object etc. But all I managed to receive was in format System.Boolean[]. I only wanted to send new client name info to others, that's all.

    Last but not least, about the PUN. Is there anyway to make a temporary subscriber-provider system that detects new chatclients, if chat client is part of the game in some gameobject. Can PUN send that client name data through network to the other listeners? But that needs to be done inside room right? Or just right away after when photon is connected, not need to be in room yet? There has to be some way to create your own list even manually. Because PhotonChat has way too much good features already that can be used in many ways.

    Any help is welcome.

    (sorry my bad grammar)
  • I will answer only about chat.

    Current idea was to build chat like in game chat. What does this mean? This mean that you create channels according your game logic. For instance team channel, guild channel, or game channel. You know all users how should be inside from other source, not from chat, but from some game logic.
    For big generic chats list of users may be very big and actually not useful. Check for instace WoW. in generic chat you see only messages, but you may iteract with player names right in chat window. List of players removed, because it takes space.
    What are you going to do with this list? take random player and send him message? Why? if he wrote something to chat, good. than you will put him into your list. if he keeps silence, why do you need to write him? if you really need, add him as friend and send private messages.

    What is your scenario? Why do you need this list?
  • Here is my sceanario and why I want a way to get the usernames in a chat:

    My game is turn-based and uses an asynchronous structure for the most part. Recently I updated the game to include a live gameplay mode. Chat has been great as a way to help connect players and let them talk during the matches.

    My online community is very small and it would be awesome to be able to see if *anyone* is online in order to arrange a game. On top of that, in-game chat is only 1-4 people so it would again be nice to see which are online at the same time or to even list their usernames. If you join last, for instance, you don't know who is already in the room and have missed any "joined" type messages.

    I can think of a couple workarounds but they are not ideal.

    Thank you,
  • Thank you for your sharing.

    We will think about it
  • This is a must feature for chat, Photon Chat should include it!
    Implementing this on client side results in a lot of hidden messages for sync and history messages lost for new connections.
    Is planned to be available in future?
  • yes
  • Hello
    How can i add rooms within a specific channel. And it one to be global and two private.
    If you provide me with an example i will appreciate

  • there is no such functionality in our sdk. I believe that what you described should be implemented on client. i mean that you just create global channel and private channels and than represent them in your client in a way you need
  • I'm in a similar situation. Game is in alpha state, so very small player base. And it's sync multiplayer, so people use my channel "Global" to talk to people and see if anyone is there and wants to start a match. Currently, they cannot see who else is online and in the chat room.

    1. Is there any updates or progress on this? (i.e getting a list or channel subscribers)
    2. If I still can not list all players in my "Global" channel, is there a way I can at least get the number of players in the channel?
    3. If none of the above is possible, what's the best current workaround?

    Assuming "3":

    One workaround I've been thinking of is having the player automatically joining an "invisible" parallel channel called "GlobalSubscribers". All players automatically send an empty message in that channel every minute or so, and the receiving clients keep track of these messages by holding the sender names and the latest timestamp in a list or dictionary or something, and as such can keep a realitively updated list.

    Any other ideas?
  • Hi @Bankler,

    1. We have added a new feature of publishing susbcription and unsubscription events along with previous list of subscribers. This is currently being tested. I cannot give you an ETA but I will ask if we can arrange an early access somehow. I'm not promising anything though.
    2. I will check and see if this is possible and get back to you.
    3. Your workaround is good but I wonder why you did not make use of the Status channel in combination with AddFriends. So here is how I see it:

    Each client needs a list of userIDs. This can be obtained using your "GlobalSubscribers" channel and a cached list.
    Call AddFriends using that array of userIDs (max allowed is 512).
    Every user needs to set his status using SetOnlineStatus and anyone who has added him as a friend will receive the status update.
  • Hello,

    Getting a list of users in the current chat room is a must have for multiple reasons..

    1 : Would you start talking in a room if you don't know the number of people in that room?

    2 : Not being able to add someone in your friend list if he hasn't talked on the chat yet is a big issue.

    3 : When you join a private room with your friends you want to know who is in the room already.

    4 : For big generic chat with a huge list of users just let us handle that on the client side. We can just display the user count instead of each individual users.

    Is it that complicated to implement on your side?

    This is really a must have feature, please consider giving us the option to get the number of users in a channel, that would improve the chat considerably.

Sign In or Register to comment.