This is one part of the Verona Online Assessment Standards. All messages are sent via the postMessage function of the html page. The widget takes the page root of its parent as target (parent.window), and the application binds the function call to the iframe element of the widget.
Most important, the message body carries as first parameter the operationId of the message.
The html page MUST contain a script-tag with metadata. The syntax and structure of this data are described here.
Ready Notification
The widget announces that it's code is loaded and initialized so the communication can start.
Accepts the following message:
{
"metadata": "string"
}
Start Command
The application sends execution parameters.
Accepts the following message:
{
"sessionId": "idk8ur5jf9ru5jk",
"parameters": [
{
"key": "string",
"value": "string"
}
],
"sharedParameters": [
{
"key": "CODE_MODE",
"value": "INSTRUCTIONS_ONLY"
}
],
"state": "string"
}
State Changed Notification
The widget sends state data.
Accepts the following message:
{
"sessionId": "idk8ur5jf9ru5jk",
"timeStamp": "2019-08-24T14:15:22Z",
"sharedParameters": [
{
"key": "CODE_MODE",
"value": "INSTRUCTIONS_ONLY"
}
],
"state": "string"
}
Close Requested
The widget calls for closing the widget dialog.
Accepts the following message:
{
"sessionId": "idk8ur5jf9ru5jk",
"timeStamp": "2019-08-24T14:15:22Z",
"saveState": true
}
The session id flags all communication. If a message has no or empty session id, it's not processed. The session id is unique and was generated by the application. Any simple algorithm would work. The session id helps to link the correct unit with the data of the message. Using the id of the editor hosting html element is less reliable, because the element could be reused with another unit.