The only other way I can think of to catch it is on the onMessage function listed in the initpreview and just make an if statement for it, problem with that is I don't know what to compare for it.
Am i approaching this completely the wrong way?
Yes, using the onMessage function is probably the best option for this.
You can create a switch statement that will look for the @class attribute (For example, for ChallengeStartedMessage it will be ".ChallengeStartedMessage".
For more granularity, you can inspect the contents of the message to further funnel the message to it's appropriate place, for example checking the Summary of ScriptMessages.
Thanks for the reply,
Is it just
that I compare to ".ChallengeStartedMessage"...
because none of these seem to work for me.
message.summary is accessible though I guess I will use that for now.
Hi d deo,
It should be the message.@class that works.
If you're having any issues with parsing the response, make sure to test the message using the Test Harness. You can see exactly what is being returned and in what format so you can more accurately parse what you need.