Disconnection of photon chat ui get red dot when a players connect

Options
PabloMonfort
edited March 2019 in Photon Chat
i need help asap, we are experiencing a bug , we use PUN and photon chat ui, and alot of plugins and stuff, the pun works fine it dosnt disconnect only when we get lost internet or something like that, but the photon chat ui it disconnect when some body join to room , its weird, i cant find a solution to this and my boss its kind nervous and he wants me to fix it , so i come here to search help, any one have experienced it? we use unity 2017.4.17f1 TLS version and the photon plan with 100 users and the chat plan of 100 users too, so. My question is, how can i fix this? i try to add some code for reconnection but didnt work. i add the apllicationOnPasue stuff for disconnect and then try reconnect stuff i sopouse since i didnt find any help of this in docs. here is my code
///
 public void OnApplicationPause()
        {
            Disconnect();
            _chatClient = new ChatClient(this, ConnectionProtocol);
        }
///

//
public void OnDisconnected()
        {
            Reset();
            ChatUI.OnDisconnected();
            ThetryReconnect();
        }
        public void ThetryReconnect()
        {
            _chatClient = new ChatClient(this, ConnectionProtocol);
        }
//
so my question is , didnt should this work to reconnect? i just cant understand where it does the connection anyways i only know that works the first time when you join and it use the PUN player name right as we need, but if another connects it disconnect and the game still works and pun works i tested it myself, and it dosnt reconnect even with my code, how can debug this myself and fix it any guidelines there? .
and we need the chat fixed ASAP coz its a social game so we need it asap working thanks.
our PUN version its v1.87 (11. October 2017)
Unity 2017.4.17f1 TLS version
Photon chat 100 users plan and same for pun...

Comments

  • PabloMonfort
    Options
    im creating my own chat at the end since my boss dont like to wait and you people didnt answear me fast so thanks for the help... will be waiting for the answear anyways since the photon chat ui seems great the only bad i saw with it was this bug and i cant fix it in anyway it dosnt reconnect once its disconnected :(
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @PabloMonfort,

    Thank you for choosing Photon!

    No need to create a new instance of ChatClient every time.
    This is needed one time only when the app starts or in case that becomes null somehow/unexpectedly and you still need it
    There is no call to ChatClient.Connect at all in the snippet you provided, creating a new ChatClient instance will not automatically call connect for you.
    Also, you are using OnApplicationPause in the wrong way:
            public void OnApplicationPause(bool paused)
            {
                if (paused) 
                {
                    Disconnect();
                } 
            }
    
            public void OnDisconnected()
            {
                Reset();
                ChatUI.OnDisconnected();
                TryReconnect();
            }
    
            public void TryReconnect()
            {
                if (_chatClient != null)
                {
                      if (!_chatClient.Connect(_chatClient.AppId, _chatClient.AppVersion, _chatClient.AuthValues))
                     {
                          // todo: log error?
                     }
                } 
                else 
                {
                      // todo: create new _chatClient?
                }
            }
  • PabloMonfort
    Options
    ok thanks man i will try that this later and will check how it works and if it dosnt disconnect and with out we can connect again coz the bug was that , the disconnection from no where without any exception or anything that i can see its just when some body connect just boom disconnect chat so well i will test this code later since i start to work later for him. thanks for the help have fun.
  • PabloMonfort
    edited March 2019
    Options
    https://i.gyazo.com/thumb/1200/0ed728090a8ad09788600e4e50f87dc4-png.jpg it fixed thanks for the code ;)
    i tested it with my two pcs and worked , still have to know about the community test when it get released this new fix version , so i would let you know in future for any details ok thanks very much have fun.