Can't connect with same username on Photon self hosted

Ramji
Ramji
edited August 2018 in Photon Server
Hi guys!

I'm using Unity 2017.4.3 and the "PUN 2 - FREE" Unity Asset to develop an app that is working fine with Photon Cloud.
I'm now trying to switch it to a Photon self hosted server, but it seems like there are a few differences.

I used to be able to join the same room with multiple clients sharing the same username. It doesn't work with self hosted, I get this response:
OperationResponse 226: ReturnCode: 32746 (Join failed: UserId 'ramji' already joined the specified game (JoinMode=1).). Parameters: {} Server: GameServer

Also, when I get the number of users in my room on another client, it displays 2, even though I just created my room and only the master is connected to it.

Any idea about what are the changes to do when switching from cloud to self hosted?

Thanks!

Comments

  • Hi, @Ramji

    >OperationResponse 226: ReturnCode: 32746 (Join failed: UserId 'ramji' already joined the specified game (JoinMode=1).). Parameters: {} Server: GameServer

    this is what I would expect even for the cloud. maybe my colleague @JohnTube may explain this.

    >Also, when I get the number of users in my room on another client, it displays 2, even though I just created my room and only the master is connected to it.

    are you using expected users? What parameter are you using to create a game?

    best,
    ilya
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited August 2018
    Hi @Ramji,

    Thank you for choosing Photon!

    The behaviour should be the same for the latest versions of PUN, for PUN2, on Photon Cloud and self-hosted Photon Server.
    Rooms expect users to have unique UserIDs.
    Maybe you were using a very old PUN version or another old client SDK which allowed to join rooms using multiple clients having the same UserId.
  • Hey @JohnTube and @chvetsov ! Thank you so much for your quick answers.

    I joined the team on this app quite recently, and the network was already developed long ago, so the "very old PUN version" theory seems totally possible.
    I'm going to try to update everything when I have more time.

    For the player count in the lobby, we use RoomInfo.PlayerCount, but is there a better way?
    We don't use expected users. We were relying on the fact that each user gets a new ID (incremental) when joining the room.

    >What parameter are you using to create a game?
    I'm not sure exactly what you're meaning.
    We create a room like so:

    var roomOptions = new RoomOptions();
    roomOptions.IsOpen = true;
    roomOptions.IsVisible = true;
    /* ... */
    PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, lobby);
  • yeah, I see.

    Please upgrade and test

    best,
    ilya