How is joinRandomRoom() supposed to fail?

I am making a browser multiplayer game and using Photon Realtime javascript SDK.

The docs state that joinRandomRoom "fails if all rooms are closed or full." (

But the docs have no information on what happens in failed case. Will it throw an exception? Or return false? Or raise some onJoinRandomRoomFailed event?

At least in my case it seems to always return true and never throws an exception.

So how am I supposed to know if join random room fails?


  • Calls to server are asynchronous, joinRandomRoom() can't fail at call time.
    To check the result of operation you need to implement onOperationResponse() callback: if operation code is Photon.LoadBalancing.Constants.OperationCode.JoinRandomGame and errorCode is Photon.LoadBalancing.Constants.ErrorCode.NoRandomMatchFound , then the last joinRandomRoom() failed because it could not find a room. See demo-particle and other demos for onOperationResponse() sample.