Getting OnLeftRoom after OnDisconnected (PUN 2.12)

Options
Hello,

I'm doing some tests involving trying to leave/join a room at the same time it is being closed. I just got something strange on the "slave" client:

- I called LeaveRoom()
- Then received an RPC
- Called PhotonNetwork.SendAllOutgoingCommands() and set PhotonNetwork.IsMessageQueueRunning to false
- Loaded a scene containing PhotonViews and PhotonTransformViews.
- Set IsMessageQueueRunning to true
- Got disconnected from the server (DisconnectByServerLogic)
- Then got the OnLeftRoom() callback.

The master client closed the room and sent the RPC roughly at the same time LeaveRoom() is called on the slave.

I've been able to reproduce this (but only once).

When things go right this happens:
- I call LeaveRoom()
- I get OnLeftRoom()
- I don't get the RPC.

So the things that puzzle me are:
- Getting an RPC after calling LeaveRoom() (maybe not technically incorrect since it was before OnLeftRoom(), but unexpected)
- Getting OnLeftRoom() after OnDisconnected().
- And also I wonder why my client got disconnected...

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @olistan,

    - Getting an RPC after calling LeaveRoom() (maybe not technically incorrect since it was before OnLeftRoom(), but unexpected)
    - Getting OnLeftRoom() after OnDisconnected().


    Both of these are correct expected behaviour.

    - And also I wonder why my client got disconnected...
    possible causes:
    set PhotonNetwork.IsMessageQueueRunning to false

    or
    - Loaded a scene
  • olistan
    Options
    JohnTube said:


    - Getting an RPC after calling LeaveRoom() (maybe not technically incorrect since it was before OnLeftRoom(), but unexpected)
    - Getting OnLeftRoom() after OnDisconnected().


    Both of these are correct expected behaviour.
    Ok, thanks, that's good to know. I have to say that I don't find this very intuitive or convenient, though :).
    I have to add a test in all my RPCs to check that we haven't left the room. Same in OnLeftRoom().
    JohnTube said:

    - And also I wonder why my client got disconnected...
    possible causes:
    set PhotonNetwork.IsMessageQueueRunning to false

    or
    - Loaded a scene
    Hm ok, but that doesn't tell me what PUN decided was so wrong that the connection had to be cut.
    Thankfully it only seems to happen in a very special case that I have now fixed.