Command
Subscribe to control commands (actions)
1. Settings
1.1. Topic Name
All global variables are supported. For example,
wk/${USERNAME}/${APP_INSTANCE_ID}/commandDefault:
wk/command1.2. Quality of Service (QoS)
Quality of Service (QoS) ensures different message delivery guarantees in case of connection failures.
Default: At Most Once (0)
1.3. Retain Handling
Control whether Webview Kiosk should receive existing retained messages when subscribing.
Default: Do Not Send (2)
1.4. Retain as Published
Controls whether retained messages from the broker keep their original retained flag when delivered to the subscriber.
Default: false
2. Payload
In addition to the Shared Subscribe Payload Properties, the following properties exists for all commands:
| Property | Type | Description |
|---|---|---|
command | string | The command to execute, e.g. clear_history. |
interact | boolean (optional) | Whether a user interaction should be triggered. For example, this will restore brightness if Web Lifecycle -> Dim Screen on Inactivity (seconds) is configured. Default: true |
2.1. Go Back
Navigates one page back in history.
Example payload:
{
"command": "go_back"
}2.2. Go Forward
Navigates one page forward in history.
Example payload:
{
"command": "go_forward"
}2.3. Go Home
Navigates to your configured home page.
Example payload:
{
"command": "go_home"
}2.4. Refresh
Refresh the current webview page.
Example payload:
{
"command": "refresh"
}2.5. Go to URL
Navigates to a specific URL.
Example Payload:
{
"command": "go_to_url",
"data": {
"url": "https://webviewkiosk.nktnet.uk"
}
}2.6. Search
Perform a query search using the selected search engine. This is the same as using Webview Kiosk's address bar.
Example Payload:
{
"command": "search",
"data": {
"query": "How to Train Your Dragon"
}
}2.7. Clear History
Removes the navigation history, leaving the current URL as the only entry in the stack.
Example Payload:
{
"command": "clear_history"
}2.8. Toast
Shows a short toast message.
If the message is empty or only contains white space, no toast will be shown.
This is still helpful in triggering a user interaction with the interact property.
Example Payload:
{
"command": "toast",
"data": {
"message": "Welcome!"
}
}2.9. Lock
Start lock task mode (or screen pinning) depending on whether Webview Kiosk has device owner permissions.
Please note that for screen pinning, the user will be prompted to confirm the action, which needs to be done on the device.
If possible, we recommend to always enable lock task packages for Webview Kiosk - more details in the security section.
Example Payload:
{
"command": "lock"
}2.10. Unlock
Stop lock task mode (or screen pinning) depending on whether Webview Kiosk has device owner permissions.
Example Payload:
{
"command": "unlock"
}2.11. Reconnect
Disconnects, then reconnect and rescribe to all MQTT topics.
This is helpful if you have updated any MQTT-related settings, which requires a reconnection to apply.
Example Payload:
{
"command": "reconnect"
}2.12. Lock Device
Turns the device screen off. Note that this will also stop the MQTT connection.
Example Payload:
{
"command": "lock_device"
}