About ChatClient.PublicChannels dictionnary and chat history

Options
I am trying to view chat history (the messages of other user before the current user subcribed into a channel). From Chat Intro I saw that all messages are stored within ChatClient.PublicChannels, but when I tested, it only stored the messages from the time that current user subcribed (I chat in other devices before connected and only see the messages from the moment I connected (subcribed OnConnected). So did I make some mistake or this is the limitation of the dictionary? How can I do to catch the messages from other user even before I connected?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @nhminh71,

    Thank you for choosing Photon!

    Photon Cloud keeps up to 100 messages per channel as long as there is one user subscribed to that channel. If you want to persist history even if the channel is destroyed on Photon Cloud, use Photon Chat WebHooks.
    If you want to get messages from history when you subscribe, use the appropriate method that requests this. For example:

    ChatClient.Subscribe(string[] channels,int messagesFromHistory)

    You can set messagesFromHistory to -1 to get up to 100 previous messages if any.