JoinRandomSession vs SessionListUpdated

SPF
SPF
edited April 2021 in Photon Bolt
Hi, I want to let a client to join a session, both randomly or the first available in session list are fine. However I want to let this user have 30 seconds to do this, meaning after the first trying of joining, if there's no session, then he/she should repeatedly try joining until 30 seconds passed. (Then this client start as Master and creates its own session).

My questions:
1 It seems `SessionListUpdated` can fulfill my goal. But what about `JoinRandomSession`? Is `JoinRandomSession` a one time try or does it keep trying joining any new sessions available until it get canceled or timed out?
2 If there're several users trying to join the same session, some might fail due to the max players limit. What's the safe way to handle Joining sessions failure(for both `JoinRandomSession` and `JoinSession`)? I haven't found session fail related callbacks.

Thanks!

Comments

  • Hi,
    1 It seems `SessionListUpdated` can fulfill my goal. But what about `JoinRandomSession`? Is `JoinRandomSession` a one time try or does it keep trying joining any new sessions available until it get canceled or timed out?

    The "JoinRandomSession" will just try to join any available Session, if there is no one available, it will fail and you will get a callback for that. That is why, in the Getting Started Sample, we use the "SessionListUpdated" to look for the sessions for a period of time before starting as Server.

    - https://github.com/BoltEngine/Bolt-Sample/blob/master/GettingStarted/Scripts/Menu.cs#L139
    2 If there're several users trying to join the same session, some might fail due to the max players limit. What's the safe way to handle Joining sessions failure(for both `JoinRandomSession` and `JoinSession`)? I haven't found session fail related callbacks.

    Take a look at our docs: https://doc.photonengine.com/en-us/bolt/current/gameplay/global-callbacks
    Specially at "SessionConnectFailed" and "ConnectFailed".

    --
    Ramon Melo
    Photon Bolt Team