Setting userId for Photon Voice on self-hosted windows server

Hi, I have a test project to try some photon features, and I wanted to have photon voice on it. It works fine on photon cloud, but when switching to self-hosted server, photon voice doesn't work.

It seems that when the first player connects and creates the room, everything goes well, but when the next player wants to join, the server logs this warning:

2018-05-08 17:18:12,015 [11] WARN Photon.Hive.HiveGame - JoinApplyGameStateChanges: Game 'Default Room 2_voice_' userId '' failed to join. msg:Join failed: UserId is not set, checkUserIdOnJoin=true expects a UserId. -- peer:GameClientPeer: PID 8640, IsConnected: True, IsDisposed: False, Last Activity: Operation 226 at UTC 5/8/2018 8:18:12 PM in Room Default Room 2_voice_, IP,

We are already setting the userId like this:

PhotonNetwork.AuthValues = new AuthenticationValues(SystemInfo.deviceUniqueIdentifier); PhotonNetwork.ConnectUsingSettings("PUNTest1");

Any clue of why this happens?


  • JohnTube
    JohnTube mod
    edited June 2018
    Hi @pablomiceli24,

    Thank you for choosing Photon!

    Photon Cloud runs a newer Photon Server version that has this issue related, on Photon Cloud if the client does not provide a UserId, the server will assign a new GUID for it.
    However, here is a workaround that allows setting UserId for Photon Voice client:

    in "PhotonVoiceNetwork.cs":

    replace line 154
    return instance.client.Connect(voiceMasterAddress, null, null, null, null);
    return instance.client.Connect(voiceMasterAddress, null, null, voiceNickname, new LoadBalancing.AuthenticationValues(voiceUserId));
    Replace voiceNickname with a string of your choice.
    Replace voiceUserId with a string (non null, non empty) of your choice.
  • Thanks @JohnTube , that did the trick.
  • mschult2
    edited June 2018
    I did a lot of searching over the past couple days, and finally this post has the solution to my problems! Thanks!

    P.S. It seems odd that the voice user id isn't exposed in a client API, given that it's required by the server. I'm guessing this bug is getting fixed by Photon?
  • Hi @mschult2,

    Thank you for choosing Photon and sorry for the delay.

    Photon Voice 1.16 is released and we now use the same Nickname and UserID from PUN when we connect to self-hosted Photon Voice Server.
  • I am running the demo from photon voice 1.16 and the same problem. It is not fixed.
  • Ramiro said:

    I am running the demo from photon voice 1.16 and the same problem. It is not fixed.

    Make sure to set the "PublishUserId" option of the room to true before creating it, otherwise the UserID will be an empty string and that will be a problem. That worked for us.

    roomOptions = new RoomOptions() { PublishUserId = true };
  • JohnTube
    JohnTube mod
    edited March 2019
    Hi @pablomiceli24,

    Do you mean PUN rooms or voice rooms?

    EDIT: PUN Rooms, see post below for more details.