Photon Chat losing messages on Android

It seems that after a period of time, my Android clients will stop receiving messages on certain channels.
I have tried re subscribing and that doesn't help, everything returns as if successful.
The only way that I have found to solve the problem is to shut down an reconnect periodically, but this is not ideal for many reasons.
I would like to be able to detect when things go wrong so I have error messages at INFO and I see nothing related to the drop off.
Very frustrating, we will probably have to drop Photon Chat as it doesn't seem reliable in real world settings on Mobile.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @DavidSWu,

    Thank you for choosing Photon!

    What SDK are you using?
    What version?

    I think maybe the client is getting an expected disconnect due to timeout.
    And this is not handled properly.
  • We are using the Unity Photon Chat, we upgraded to the most recent version and we are still losing subscriptions.
    We reconnect on disconnect. I know for sure that we are connected and subscribed, we just don't receive messages on certain channels and there are no messages or info.
    We are using the ASIA servers. It seemed to work slightly better on the US servers but our customers are in ASIA now.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @DavidSWu,

    The only way that I have found to solve the problem is to shut down an reconnect periodically, but this is not ideal for many reasons.
    This suggests that the issue is likely on the client and not on the server(s).

    We are using the ASIA servers. It seemed to work slightly better on the US servers
    How so?

    OK, so you are saying some Android clients, after a while, stop receiving messages from (a) public channel(s) while they appear to be connected and subscribed to the same channel(s). Is that it?
    But can they publish messages successfully in the same affected channel(s)?
    Does this happen with all channels or specific ones?
    Does this happen for private channels as well?
    If you use the status updates feature, what is the status of those clients? Do their friends still seem them as connected/online?

    How did you test this?

    We need to understand the problem exactly to be able to help you.
  • We only send public messages on channels, no private messages.
    It seems like individual channels do not send and or receive messages for about 1 out of 50 subscriptions and it seems to affect PC as well. I.e. clients send heartbeats on certain channels and sometimes they will send no heartbeats at all. But there are no debug messages output with Debug Level on INFO. The messages simply don't get broadcasted. But other channels still work.
    I've only started seeing this recently and it seems like it may have coincided with us switching to ASIA servers.
    I am certain that the client is calling the function to send the messages, as I write status to the screen when sending.
    We have the 500 CCU plan, and we are using around 100 CCU so we are not going over.

  • I should mention that we do not use photon chat for chat, we use it to send state information about players every 2 seconds, to enumerate all players in game and to communicate state information about instances.
    Also, we have tried TCP and UDP connections and using a background thread for sending (or not), and the problem persists with all combos.
  • JohnTube
    JohnTube ✭✭✭✭✭
    hi @DavidSWu,

    Send an email to developer@photonengine.com with all details about your app (AppId, AppVersion, etc.) and how to reproduce the issue, also with link to this discussion.
    We will get back to you.
  • Sophie
    Sophie
    edited July 2019
    Hello, I have the same issue like DavidSWu, the only difference is that, we use it to send Messages in a global chat. Sometimes, we successfully subscribe and join in this channel and sometimes not. There's no error as well or any logs that say something is wrong, it just doesnt subscribe/join.
    Second problem is I encounter some old messages being retrieved in OnMessagesReceived(). Please help.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited July 2019
    Hi @Sophie,

    Do you use Photon Chat from PUN Classic or PUN2 or standalone?
    Which version?

    Sometimes, we successfully subscribe and join in this channel and sometimes not. There's no error as well or any logs that say something is wrong, it just doesnt subscribe/join.
    This is difficult for us to reproduce or investigate. How can you know for sure that a client does not subscribe to a channel? Do you have a timeout detector after Subscribe calls for not receiving callback IChatClientListener.OnSubscribed(string[] channels, bool[] results)?

    Maybe the client disconnected and reconnected to a different region?
    Photon clients need to be connected to the same region (servers) and virtual application (AppId, AppVersion) to be able to communicate w/ each other.
    You could use private messages or status messages (friends) to make sure a client is 'connected and reachable' from other clients.

    After verifying that the clients are connected to the same region, to debug this, you can use PublishSubscribers feature to detect from other clients already subscribed to a channel if a user is susbcribed or not.

    For the second problem, OnMessagesReceived() call when you first subscribe or resubscribe to a channel can contain up to 100 messages from the channel's history. If you do not want to receive any messages from the history or limit those to a number lower than 100 you could use the historyLen or messagesFromHistory parameter in Subscribe method. If you want to get only what you missed use the lastMsgId parameter in Subscribe method.
  • same issue to day, it work on dev build but not work in release build