Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by John Peterson · Jun 20, 2018 at 08:23 PM · photonwebhooks

Photon WebHooks not triggered?

Dear PlayFab community,

I have the same problem as this thread.

However, none of the resolutions in the thread seem to apply to me. As far as I can tell, I've got everything configured properly on both ends, but none of my WebHooks are getting triggered.

I'm following the Photon PlayFab integration instructions.

Here are my Photon settings in Unity:

And a successful connection is made with the following C# code:

private static string Version = "0.1";

private void ConnectPhoton(string PlayFabId, string token /*from PlayFabClientAPI.GetPhotonAuthenticationToken()*/)
{
	// Set up the Photon authentication aspects.
	AuthenticationValues authenticationValues = new AuthenticationValues();
	authenticationValues.AuthType = CustomAuthenticationType.Custom;
	authenticationValues.AddAuthParameter("username", PlayFabId);
	authenticationValues.AddAuthParameter("token",    token);

	PhotonNetwork.AuthValues = authenticationValues;

	// Connect to Photon.
	PhotonNetwork.ConnectUsingSettings(Version);
}

Photon AppID: f3416d52-4d66-4ac0-9d8a-75b545a8925d

(Note that the BaseUrl has the SECRET_KEY appended and is not shown here. I have confirmed that this is the same value that appears in the PlayFab Photon Add-On module.)

PlayFab (AppID: 44b1) CloudScript:

interface IPhotonResult
{
   ResultCode: number,
   Message:    string
}
const photonSuccess: IPhotonResult = { ResultCode: 0, Message: 'Success' };

var RoomCreated = function(args: any, context?: IPlayFabContext): IPhotonResult
{
   Log.Debug("photon_room_created", JSON.stringify(args));
   WritePlayerEvent("photon_room_created", args);
   return photonSuccess;
}
var RoomClosed = function(args: any, context?: IPlayFabContext): IPhotonResult
{
   WritePlayerEvent("photon_room_closed", args);
   return photonSuccess;
}
var RoomJoined = function(args: any, context?: IPlayFabContext): IPhotonResult
{
   Log.Debug("photon_room_joined", JSON.stringify(args));
   WritePlayerEvent("photon_room_joined", args);
   return photonSuccess;
}
var RoomLeft = function(args: any, context?: IPlayFabContext): IPhotonResult
{
   WritePlayerEvent("photon_room_left", args);
   return photonSuccess;
}
var RoomEventRaised = function(args: any, context?: IPlayFabContext): IPhotonResult
{
   WritePlayerEvent("photon_room_event_raised", args);
   return photonSuccess;
}
var RoomPropertyUpdated = function(args: any, context?: IPlayFabContext): IPhotonResult
{
   WritePlayerEvent("photon_room_property_updated", args);
   return photonSuccess;
}
var WebRPCTest = function(args: any, context?: IPlayFabContext): IPhotonResult
{
   WritePlayerEvent("photon_webrpc_test", args);
   return photonSuccess;
}

handlers["roomCreated"]         = RoomCreated;
handlers["roomClosed"]          = RoomClosed;
handlers["roomJoined"]          = RoomJoined;
handlers["roomLeft"]            = RoomLeft;
handlers["roomEventRaised"]     = RoomEventRaised;
handlers["roomPropertyUpdated"] = RoomPropertyUpdated;
handlers["webRPCTest"]          = WebRPCTest;

Thoughts?

screen-shot-2018-06-20-at-11543-pm.png (80.8 kB)
screen-shot-2018-06-20-at-35049-pm.png (46.4 kB)
Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Jun 21, 2018 at 02:49 AM

Actually, the logs show that the handlers are being called. The problem is that your WritePlayerEvent calls are invalid, and so cause the handlers to error out. The base Cloud Script example (Revision 1 in all new titles) shows some examples of how to make a Server API call.

Comment
John Peterson

People who like this

1 Show 4 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image John Peterson · Jun 21, 2018 at 03:15 AM 0
Share

Ahhh...thanks, I see that now. I thought that WritePlayerEvent was so simple that there wasn't any way for me to screw it up. ;-)

Is there a way for me to see the logs for those kinds of calls? That would have helped me to debug this issue.

avatar image Brendan ♦♦ John Peterson · Jun 21, 2018 at 06:44 AM 0
Share

Yes, use try/catch for all Server API calls, and log the error you get on any catch.

avatar image John Peterson · Jun 21, 2018 at 03:21 AM 0
Share
@Brendan, I have updated my code, and I'm getting the photon_room_left event. But I'm *not* getting the photon_room_created or photon_room_joined WebHooks (they're identical to the photon_room_left).

How can I debug this further? It seems like I don't have access to these internal logs...

avatar image Brendan ♦♦ John Peterson · Jun 21, 2018 at 06:44 AM 0
Share

I've responded in the other thread you started on this - here, for the sake of others: https://community.playfab.com/questions/20786/photon-webhooks-not-triggered-redux.html

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Photon WebHooks not triggered (redux). 7 Answers

    Photon chat webhooks not firing 2 Answers

    Photon Webhooks Problem 3 Answers

    Photon webhooks not wokring 2 Answers

    Photon webhooks are not triggered 2 Answers

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges