Skip to content

Script Engine

inSCADA JDK21 ships two distinct scripting environments: server-side (ins.*) and client-side (Inscada.*). They run in different places, target different use cases, and expose isolated API surfaces.

Server-side (ins.*)Client-side (Inscada.*)
Where it runsinSCADA server (JVM)Browser (browser JS)
EngineGraalJS (Nashorn-compat)The browser’s own engine
Bindingins (global)new InscadaApi(projectName)
PurposeAutomation, calculation, alarms, scheduled workUser interaction, UI control
Typical usageScheduled scripts, variable / alarm / log expressions, MQTT parsingAnimation click, custom HTML widgets, dashboard widgets

→ Server-side (ins.*) details → Client-side (Inscada.*) details

Scripts fire in many places across the platform. The table below shows the environment each one runs in.

ContextEnvironmentTrigger
Scheduled Scriptserver (ins.*)Periodic / Daily / Once / manual
Variable Expressionserver (ins.*)Automatically on poll cycle
Alarm Expressionserver (ins.*)Automatically on value change
Log Expressionserver (ins.*)Automatically on poll cycle
MQTT Subscribe/Publishserver (ins.*)On every MQTT message
Animation Expressionserver (ins.*)On UI update (remote)
Animation Click Scriptclient (Inscada.*)User click
Custom HTML Widgetclient (Inscada.*, sandboxed iframe)Inside the widget
Dashboard Widgetclient (Inscada.*)Dashboard render / interaction

Scripts run in isolation in both environments, but the constraints differ:

  • Server side — HostAccess.EXPLICIT: only Java methods annotated @HostAccess.Export are reachable. eval and with are disabled, host class lookup is blocked entirely (so Java.type(...) and the java.* namespace are unavailable), and there are no threads, native access, process creation, environment access or guest file I/O.
  • Client side — custom HTML widgets run inside a sandboxed iframe; they reach the host page API through InscadaBridge using origin-validated postMessage.
LimitDefaultWhat it bounds
Statement count100,000 per runA runaway loop. while(true){} is stopped in milliseconds
Execution time5 minutesA run that is stuck rather than looping — a host call that never returns

The statement limit is the one authors actually meet, and it does not arrive as a normal error: the engine cancels the context rather than throwing something catchable, so your own try/catch cannot absorb it and carry on.

On the client side there is no such budget; avoid code that freezes the browser tab.