Embedded Training Application Communication Architecture 2019-1¶
GIFT Unity Communication Architecture¶
GIFT communicates with embedded training applications through the Tutor Module where the embedded application resides. Messages sent from the Domain module to embedded training applications are sent to the Tutor client using the same pipeline as the messages that tell the Tutor client what widgets to display. Once a message being sent to the embedded training application reaches the Tutor client, it is sent to the embedded application using the window.postMessage JavaScript API on the iframe that is hosting the embedded application.
Once the index.html page inside the iframe receives the message from the Tutor client, the embedded training application can respond to the message. See the message examples section here to understand the expected format of the message.
The training application's html page should look similar to example-index.html.
LegendKey | Description |
---|---|
1 | Message received from GIFT as a JSON string. These messages include: SIMAN Messages and Feedback Messages |
2 | C# object representing the message that was received as a JSON string |
3 | Message sent to GIFT as a JSON string. These messages include: SimanResponse, StopFreeze, SimpleExampleState |
Message Examples¶
Message Type | JSON |
---|---|
SIMAN | {"payload":"{\"Siman_Type\":\"Start\",\"RouteType\":\"Embedded\",\"FileSize\":0}","type":"Siman"} |
Feedback | {"payload":"{\"StringPayload\":\"This is feedback because you pressed button 1.\"}","type":"Feedback"} |
SimanResponse | {"type":"SimanResponse","payload":"Load"} |
StopFreeze | {"type":"StopFreeze","payload":"{\"realWorldTime\":0,\"reason\":0,\"frozenBehavior\":0,\"requestID\":0}"} |
SimpleExampleState | {"type":"SimpleExampleState","payload":"{\"VAR\":\"button 1\"}"} |