ReconnectAndRejoin not working

I'm implementing reconnection to a custom Photon Server during a match, and I always receive the following error:

Operation failed: OperationResponse 226: ReturnCode: 32746 (Join failed: UserId 'killshow1523607348.5625-1857031781618890656' already joined the specified game (JoinMode=3).). Parameters: {} Server: GameServer

It happens even if i'm the only player in the room (I've also tried with several players), set PlayerTTL to 1s and wait 5s to try to reconnect. ReconnectAndJoin is call only 1 time and no other Connect calls are made.

Any ideas about why this could be happening? It used to work correctly with Photon Cloud, although the code has changed a bit to adapt it to the Photon Server.

I'm using Photon Unity Network 1.89 and Unity 2017.2.0p4.

Comments

  • Hi @Jabefa,

    Thank you for choosing Photon!

    It looks like the GameServer still think that the rejoining (JoinMode=3 for RejoinOnly) actor with userId "killshow1523607348.5625" is still inside the room and active.
    Maybe because the client unexpectedly disconnected and the GameServer is not aware of this yet as the timeout is 10 seconds I think.
    Weird if the same scenario works on Photon Cloud though. Or maybe not, Photon Cloud is running newer (still unreleased) versions always but not sure if we fixed or updated something related to this). My colleague @chvetsov should know better.
    Can you try:
    1- waiting more than 10 seconds after unexpected disconnect and use ReconnectAndRejoin?
    2- user PlayerTTL = 0 and instead of ReconnectAndRejoin use Reconnect and JoinRoom?
  • hi, @Jabefa

    this error means that your player still active in game. Do you disconnect your player from game?
    if player is active in game the only possible way to rejoin is rejoin with same token as previous connection. otherwise you will be rejected

    best,
    ilya
  • chvetsov said:

    hi, @Jabefa

    this error means that your player still active in game. Do you disconnect your player from game?
    if player is active in game the only possible way to rejoin is rejoin with same token as previous connection. otherwise you will be rejected

    best,
    ilya

    @chvetsov can you please explain it in detail? How can i get previous connection token and connect using previous token.
  • It boils down to "how do you disconnect"?
    A client has an "auth token", which identifies this client's user and session. When this is the same as before, a ReconnectAndRejoin is OK, no matter if the server knows that the client did disconnect.
    If the client calls Disconnect(), the token is gone, as we clean it (your code did disconnect deliberately, after all).
  • JohnTubeJohnTube mod
    edited February 15
    Hey @RaviIn,

    There are other discussions regarding this same error.
    See my posts here and here.

    Summary: Photon Cloud supports sessions (reuse of the same token to allow re-entering a room for the same user) which is not in Photon Server yet. Again, my colleague @chvetsov can confirm or deny my explanation.

    your code did disconnect deliberately, after all

    @Tobias I don't see how did you came to this conclusion.
Sign In or Register to comment.