Photon Turnbased frustrations

So i have been exploring each of the demos that photon has for turnbased asynch games and I cant seem to ever get the webhooks/GETGAMESLIST to work at all for any of the demos. Ive gone through the Memory tutorial multiple times and it doesnt seem to really explain anything about actually sending and receiving the webhooks.

My question is how do I use the "Photon Turnbased Webhooks Sample"(photon.webhooks.turnbased.waws) file thats on the github link? Ive set ngrok (and do receive POST requests but only get 500 internal server errors) and have set up an Azure account but they don't seem to affect anything. The readme file that is included doesn't explain anything besides setting up webconfig. It says all i need to do is to set up ngrok, Azure, and edit the webconfig file and build it with Visual studios but that doesn't work so what is the missing step(s)?

Am i supposed to import something into the demo project? Where do I place this photon.webhooks folder? am i supposed to change the code in the demo to accommodate the webhooks folder? How is the demo supposed to reference the webhooks folder at all? I deleted both folders and redid the entire tutorial and it doesn't change whether i have the webhooks folder or not so I know it some sort of reference problem.

Ive searched google and these forums and I cant seem to find any reference as to what to do. I do have my dashboard enabled as well for persistence and have the right webhooks address(i know since i can verify with ngrok). So what do I do?

Comments

  • I think you should try the webhooks using Parse. Here is a good how-to.
  • I'm sorry but whatever I do I can't reproduce your problem.

    Here some things you could tryout ...

    1) Source of issue causing Http 500
    Try setting <customErrors mode="Off" /> in the web.config to instruct IIS to display detailed error messages, instead of just "500".
    see http://stackoverflow.com/questions/4416 ... s-websites

    Note: that the project is setup to catch exceptions and return a 200 + an ErrorResponse - see WebApiConfig.Register line 30
    [code2=csharp]config.Filters.Add(new UnhandledExceptionAttribute());[/code2]
    The ErrorResponse looks like
    [code2=javascript]{
    "Message": "....",
    "ResultCode": 1
    }[/code2]

    2) log4net config
    There is a little issue with the log4net configuration when running locally:
    chaange from:
    [code2=xml]<param name="File" value="D:/home/logfiles/application/Turnbased.log"/>[/code2]to:
    [code2=xml]<param name="File" value="Turnbased.log"/>[/code2]
    *Note:* I tested with a non exitent drive - and that doesn't cause the 500 you are getting. It just silently doesn't create the log file.

    3) Redis
    did you install and made sure redis is running?

    Also this in my case doesn't trigger the 500 you mention - you should get a 200 and following message:
    [code2=javascript]{
    "Message": "could not connect to redis Instance at 127.0.0.1:6379",
    "ResultCode": 1
    }[/code2]

    You can test this locally using fireforx or chrome - using a plugin
    a) firefox: restclient http://restclient.net
    b) chrome: postman http://getpostman.com

    and sending a POST request to:
    http://localhost/turnbased/App1/GetGameList
    [code2=javascript]{
    "UserId": "MyUserId1"
    }[/code2]

    Note: Make sure to set the
    Content-Type: application/json
    
    Header - see http://stackoverflow.com/questions/2238 ... pi-service

    5) Run VS as admin
    In my case i get an error if i start the project as non-admin and the project is not loaded - so it can't be run.
    Just in case its different for you - try running the VS as admin.

    4) Change from IIS to IISExpress
    It may be some IIS/System configuration issue ... try changing the project to use IISExpress - in Project properties go to "Web" and select IISExpress.
    In my case it offers to use a url that looks like this: http://localhost:2541/ Save and press F5. You will get a page saying "HTTP Error 403.14 - Forbidden." which is expected - now test like described in 3) just change the url to [url=http://localhost:XXXX/App1/GetGameList]http://localhost:XXXX/App1/GetGameList[/url] where XXXX is the port you setup in your project.