PREVENT Sending Private Messages to offline users

TreviseTrevise
edited October 2014 in Photon Chat
Can I prevent sending private messages to offline users? I can't find anything to use to check if a userid is online and able to receive messages.

Thanks ahead of time.

Edit: I'm using PUN.

Comments

  • PUN does not support offline messages. You can only reach the other players in a game. Outside of games, the communication is restricted.
    You can check online state of your friends by using FindFriends with their user IDs. However, the friend list and management is not part of Photon itself.
  • I see what your saying, but here's my issues. When a player sends a private message to an offline player, OnPrivateMessage is still called and therefore they don't receive a message "That player is offline, they did not receive your message". I want to have a way to check if the player is online before a message is sent to them, so I can prevent sending the private message and give them said message above.
  • Any news on this?
  • it is not so easy to implement this.

    if you send private messages to your friend, you may check his status locally
    if target player is not friend, than there is no sulution at the moment
  • Aye that is what I'm currently doing. Is this a planned feature for PUN or the chat? It would seem any game would need this as pretty much every online game you can't send messages to offline players.
  • As Chat does not handle (persisted) user accounts, it can't really store messages for offline users either. We decided we want to focus on the online and realtime communication side, so this is very unlikely to happen.
    We do realize this is missing, so we partner with PlayFab. They focus on the user accounts, inventory, push messaging, etc. I guess you can implement an offline mail box in their service (but I didn't check this particular feature). Their service is going to include a Photon Cloud subscription, so things will become easy to handle, too.
    This partnership is really fresh but let us know if you need to know how to combine things.
    Let us know what you think about their service and if it would fit.
  • I do NOT want to queue or save messages. I do NOT want to send messages to offline players. Can you please re-read my posts? I'll change the thread title in order to clear up some confusion.
  • in psuedo code

    if(playerid.online == true){
    chatClient.sendprivatemessage(player);
    }else{
    sendmessage("That player is not online.");
    }

    This is all I want.
  • You can only check the user's online state for friends. Use AddFriends and RemoveFriends to let the server know which user's you are interested in.
    You implemented IChatClientListener.OnStatusUpdate(user, status, gotMessage, message). This is called when some online status changes (and initially, when you add friends).

    There is no client-side list of players that have the state. I would create a HashSet<Friend> Friends and per Friend, you can store the username, status, etc. In OnStatusUpdate you have to update the Friends accordingly.
    This is the missing piece for the playerid.online check.
  • Alright. That is currently how I have it setup . I just wanted to know if I could check states of players that were not friends.
  • Sorry for the misunderstanding and making things more complicated than they are.
    We assume you are friends, if you are interested in someone's status. But on the other hand, it's not like we handle a proper friends list with friendship requests, so it's still easy to have "friends".
  • Good point. I could just make friend temporary for the check. Thank you for the help!!
Sign In or Register to comment.