This is one part of the TBA Plugin Standards.
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": "CODE_MODE",
"value": "INSTRUCTIONS_ONLY"
}
],
"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",
"sharedParameters": [
{
"key": "CODE_MODE",
"value": "INSTRUCTIONS_ONLY"
}
],
"state": "string",
"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.