Offscreen Websocket mode fully supports math interactive features. This page describes the corresponding WebSockets messages.
These messages rely on a math solver controller on the server that mainly allows you to handle:
They consist in two messages: a mathSolver to perform an action on the math solver controller and its corresponding response mathSolverResult.
{
"type": "mathSolver",
"action": [enum] "available-actions" | "numerical-computation" | "get-diagnostic" | "get-variables" | "set-variable-value" | "get-variable-value" | "remove-variable-value" | "as-variable-definition" | "get-variable-definitions" | "get-evaluables" | "evaluate",
"blockId": [string] <the block id>,
"task": [string] <the action for which a diagnostic is requested>,
"variableName": [string] <the variable name>,
"variableValue": [double] <the variable value>
"evaluation": {
inputVariableName: [string] <the input variable name>,
outputVariableName: [string] <the input variable name>,
from: [double] <the start of the range to evaluate>,
to: [double] <the end of the range to evaluate>,
pointCount: [int] <the number of values to evaluate between [from, to]>
}
}
The server sends you a mathSolverResult containing the math solver result.
{
"type": "mathSolverResult",
"action": [string] <the action requested in mathSover message>,
"result": [Object],
"blockId": [string] <the block id>
}
Returns the available actions for the specified block.
Returns the output for the numerical computation of the specified block.
To help troubleshoot, the get-diagnostic gives you diagnostics on a given task and the specified block.
It can be useful to understand why get-evaluables returns an empty array, by calling it with an evaluation task
or to find out why available-actions does not include the numerical-computation action in the returned array, by calling it with a numerical-computation task.
It also returns a MathDiagnostic code so that your application can get information about error situations, such as computation errors, and that you can map to an error message in your application to let end users know what’s going on.
Returns information about defined variables, associated with the specified block or from global variables.
Sets the value associated with the given variable name, for the specified block or as global variable.
Returns the value associated with the given variable name, for the specified block or as global variable.
Removes the definition of the given variable name, for the specified block or as global variable.
Checks if the specified block represents a variable definition and returns the associated information.
Returns the list of all variable definitions.
Returns the list of variable names that can be evaluated in the specified block. An expression is evaluable if it can be interpreted as a function of a given variable:
The message content is:
Returns the list of points resulting from evaluating the given variables in the specified block. This allows to get plot-ready coordinates that can be used to plot graphs using a graphics library.