Graph Messages – Script block interaction with the Remote Config block

Quote from DevSF on 04/12/2020, 09:18In this example the Script block interacts with the Remote Config block.
Following code snippet will print out the received graph message types:
To interact with the Remote Config Block the Script block reacts to three different types of graph messages:
- REQUEST_HEALTH_STATUS ( reply with health status )
- REQUEST_REMOTE_CONFIG ( reply with the Script block configuration )
- SET_REMOTE_CONFIG ( check and accept configuration changes )
The graph message may also be addressed to other RTSA block. Therefore to accept a configuration change the unique destination identifier of the graph message need to match the unique identifier of the current Script block. The Mission.block() promise returns the current Script block information together with its unique identifier.
The structure of a response is in JSON format, have a look into attached mission.
To get a feeling of the message format you can always use a HTTP Server block together with other RTSA blocks to show the JSON structures in your web browser. The graph messages are also mapped to the HTTP interface endpoints.
Following the Spectran V6 block replies to the REQUEST_REMOTE_CONFIG graph message via the HTTP endpoint http://localhost:54664/remoteconfig. Firefox for example will parse the JSON format to show it in a more human friendly way:
In this example the Script block interacts with the Remote Config block.
Following code snippet will print out the received graph message types:
To interact with the Remote Config Block the Script block reacts to three different types of graph messages:
- REQUEST_HEALTH_STATUS ( reply with health status )
- REQUEST_REMOTE_CONFIG ( reply with the Script block configuration )
- SET_REMOTE_CONFIG ( check and accept configuration changes )
The graph message may also be addressed to other RTSA block. Therefore to accept a configuration change the unique destination identifier of the graph message need to match the unique identifier of the current Script block. The Mission.block() promise returns the current Script block information together with its unique identifier.
The structure of a response is in JSON format, have a look into attached mission.
To get a feeling of the message format you can always use a HTTP Server block together with other RTSA blocks to show the JSON structures in your web browser. The graph messages are also mapped to the HTTP interface endpoints.
Following the Spectran V6 block replies to the REQUEST_REMOTE_CONFIG graph message via the HTTP endpoint http://localhost:54664/remoteconfig. Firefox for example will parse the JSON format to show it in a more human friendly way: