TypeScript - Interface Asset HTTP Request

Hello All,

I’m trying to create an TypeScript IA that can GET and POST data from a simple web server. The REST IA did not seem to fit my purpose.

It works perfectly while debugging and using “Player on all other platforms (Web, Android, etc.)”, though as soon as I play it on something else or publish it, the requests don’t appear to fire.

Does anyone have pointers for debugging this or if there are any issues with using XMLHttpRequest in an interface asset?

Hi Liam @lalford,

When you say “as soon as I play it on something else”, can you specify on which OS / which Player you are trying to use? If it’s our Player for Windows (.NET) running on a Windows machine, it’s normal, as TypeScript IAs are only available on our Player for other platforms at the moment.

Re/ your REST API and the fact the API Explorer didn’t fit your needs, would you mind opening a ticket with our support team so you can privately share more information about this? We’d love to better understand the limitations you encountered with that route.

Thanks

Seb

I added a bit of debug so the TypeScript constructor sets text string that is bound to a Simple Text asset

So when using the composer, if select “Play” when having “Simulate Player on Windows” selected, the text box does not get populated. I get the same result if I publish it and deploy it to the player running on an Android tablet.

However, if I select “Play” when I have “Simulate on all other platforms” selected, the scene and IA seem to work as expected. The text gets displayed and when triggered, all requests run.

It appears that the IA is not being created. Though I do not know of a way to debug this.

Again, this behavior is completely normal and expected. The TypeScript Interface Assets are not supported by our Player for Windows, so it’s normal the code you wrote is not loaded when using the Simulate Player on Windows Play mode in Composer.

If your end goal is to run your experience on a Windows machine, as of today, you need to create your IA either in .NET or in JavaScript (now a legacy mechanism for the JS version).

The alternative could be for us to give you access to a preview of our newer Player for Windows that will support TypeScript IAs, but that would be easier if you could create that support ticket so we can talk privately about this and better understand your project.

Thanks

Seb

Thanks Seb,

We were experiencing the issue across all platforms. We found the problem to be CORS related, though it was running fine when debugging. Adding the appropriate CORS config on our server resolved the problem.

The annoying part is, it is very tricky to debug when there is no access to any log files. Do you have any advice on debugging “live” issues with IA’s?

Thanks for your help.

Hi LIam @lalford,

If you are using a .NET IA, this Academy lesson has a section about using Visual Studio Debugger.

If you are using a TypeScript IA in our Player for other platforms, you can use Ctrl + Shift + i keyboard shortcut to open the Dev Tools while in Play mode. Make sure you have built your IA using the npm run build:debug command so you can put breakpoints in your TypeScript code.