JoinRoom failed. Client is on MasterServer but not ready for operations

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

JoinRoom failed. Client is on MasterServer but not ready for operations

Mozzz
2020-09-27 17:14:03

Hi, I am really new at this. Would really appreciate if anyone could help. I am getting this error message when a client joins a room. So what I can understand is that the client is not IsConnectedAndReady. How can I make sure it is connected and ready so I can avoid this error??
I am able to connect after this error message though. Thanks.

Comments

JohnTube
2020-09-28 11:35:10

Hi @Mozzz,

Thank you for choosing Photon!

What PUN version do you use?
What is the exact error message?

As it already hints/suggests, you probably need to wait for the OnConnectedToMaster callback to be able to call JoinRoom.

Mozzz
2020-09-28 13:05:27

Hi @JohnTube,

Thank you for your response.

I am using Photon version 2.7.

The complete error message is as follows:

JoinRoom failed. Client is on MasterServer (must be Master Server for matchmaking)but not ready for operations (State: Joining). Wait for callback: OnJoinedLobby or OnConnectedToMaster.
UnityEngine.Debug:LogError(Object)
Photon.Pun.PhotonNetwork:JoinRoom(String, String[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1742)
Launcher:joinRoom(String, Action1) (at Assets/Scripts/Launcher.cs:235) Launcher:JoinRoom(String, Action1) (at Assets/Scripts/Launcher.cs:214)
RoomChoiceByNumberAction:b__0_0(String) (at Assets/PlayMaker/Actions/UIPanelManager/RoomChoiceByNumberAction.cs:15)
RoomChoiceByNumberPanel:JoinRoom() (at Assets/Scripts/UIPanels/RoomChoiceByNumberPanel.cs:105)
UnityEngine.EventSystems.EventSystem:Update()

I dont really understand that I need to wait for OnConnectedToMaster callback? OnConnectedToMaster has already been called in my case. I am trying to join the room now by pressing the join room button.

And also, how am I able to join the room after getting this error?

JohnTube
2020-09-28 13:45:34

Hi @Mozzz,

So the client state is "Joining" which means the client is already in the process of joining a room.
So most likely you are hitting the Join button more than once.*
Try to add a flag or UI dialog or disable button while the client is trying to join the first time.

Mozzz
2020-09-28 15:16:24

Hi @JohnTube ,

Thank you for your help, I managed to fix it. You were right in some way and set me on the right track. I was actually calling the join room function twice somehow. Thanks.

Back to top