question

brendan avatar image
brendan asked

Photon cloud + Chat

angelsinhbfs
started a topic on Wed, 12 August 2015 at 1:54 AM

I am currently trying to get photon cloud and chat both working on the same game. I can get photon cloud working just fine, but I am having trouble with the chat implementation. it currently hangs at connecting to nameserver.

PlayFabClientAPI.GetPhotonAuthenticationToken(new GetPhotonAuthenticationTokenRequest
        {
            PhotonApplicationId = PlayFabSettings.PhotonChatAppID
        }, OnPhotonChatSuccess, OnPlayFabError);
        Debug.Log(callStatus);




private void OnPhotonChatSuccess(GetPhotonAuthenticationTokenResult result)
    {
        var authVals = new ExitGames.Client.Photon.Chat.AuthenticationValues()
        {
            AuthType = ExitGames.Client.Photon.Chat.CustomAuthenticationType.Custom,
            Secret = null,
            AuthParameters = "username=" + System.Uri.EscapeDataString(PlayFabSettings.Username) + "&token=" + System.Uri.EscapeDataString(result.PhotonCustomAuthenticationToken),
        };
        var chatC = PlayFabSettings.chatClient.GetComponent<ChatCore>();
        chatC.AuthVal = authVals;
        chatC.init();
        chatWindow.SetActive(true);
    }


public void init()
        {
            client = new ChatClient(this);
            client.Connect(PlayFabSettings.PhotonChatAppID, "1.0", PlayFabSettings.Username, AuthVal);
            Invoke("Start", 3.0f);
        }
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Best Answer
angelsinhbfs said on Wed, 12 August 2015 at 7:46 PM

Got it figured out. The problem was twofold. In my chatcore script i needed to call client.service() in update.

and in the last 2 snippets there I needed playfabID instead of username. this did make it so that all of my messages were tagged as being sent by my playfab id instead of the username though.


3 Comments
Brendan Vanous said on Wed, 12 August 2015 at 6:55 PM

We're currently working with the Exit Games team on this, as it appears the latest update to the Photon SDK may be causing an issue with authentication. We'll update as soon as we have more info.

Brendan


angelsinhbfs said on Wed, 12 August 2015 at 7:46 PM

Got it figured out. The problem was twofold. In my chatcore script i needed to call client.service() in update.

and in the last 2 snippets there I needed playfabID instead of username. this did make it so that all of my messages were tagged as being sent by my playfab id instead of the username though.


johntube said on Thu, 13 August 2015 at 1:19 AM

To those having issues with Photon Custom Authentication read this check list first.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.