PhotonNetowrk.Isconnected true, client state: leaving, sometimes gets stuck like this

Options
So normally I am able to leave the room fine by clicking a button, however sometimes we get stuck where we are connected to the network and our client state is leaving, but the client never actually leaves. I then get the following error:

Operation LeaveRoom (254) not called because client is not connected or not ready yet, client state: Leaving

We are connected to the network in this case because the leaveroom will only be called if we are. so why is client state stuck in 'leaving' and yet never actually leaves?

what is the best way to elegantly recover from this? I would say it happens about 1 in 10 times.

any advice appreciated. thanks.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @hellohallo,

    Thank you for choosing Photon!
    Operation LeaveRoom (254) not called because client is not connected or not ready yet, client state: Leaving
    This means you called LeaveRoom more than once.
    The first time worked which changed the client state to Leaving and the other call failed with this error.

    Maybe the client is not really stuck.
    Did you implement OnLeftRoom callback?
  • hellohallo
    Options
    Yes I am implementing OnLeftRoom callback and it is getting called normally. The issue only occurs rarely, but I've added some more logging now, so when it happens again I'll have more info. Thanks
  • hellohallo
    Options
    is it possible for the client to leave the room but the callback not to be called or would it be called in 100% of cases?

    is it possible that the client tries to leave the room but fails? if it is possible what state will it get set to if it tries and fails?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @hellohallo,
    is it possible for the client to leave the room but the callback not to be called or would it be called in 100% of cases?
    No, this should not happen. You could try to catch this inside OnOperationResponse, case OperationCode.Leave and operationResponse.ReturnCode != ErrorCode.Ok. But operation leave should not return an error unless you call it on the wrong server or when the client is not joined to a room, this cannot happen as we have client checks in place, unless you modified client code.
    is it possible that the client tries to leave the room but fails? if it is possible what state will it get set to if it tries and fails?
    Yes, check return value of LeaveRoom method and the logs for errors. The client state does not change in this case.
  • hellohallo
    Options
    Ok it happened again, but I didn't have logging to check the return value of LeaveRoom so I've just added that logging and well as logging for the clientstate before and after, so will have a more complete picture next time.
    JohnTube wrote: »
    Yes, check return value of LeaveRoom method and the logs for errors. The client state does not change in this case.

    So if we try and fail to leave the room, the client state will remain as leaving and we will not longer try to leave? Or should the client state be set back to something else if we fail to leave?