WLWebview Kiosk
SettingsMQTTTopics

Response

Publish replies to information requests

Tip

Webview Kiosk also utilises the request-response pattern for manual query of device information states.
This pattern is explained in:

1. Settings

1.1. Topic Name

All global variables are supported, in addition to RESPONSE_TYPE. For example,

wk/${USERNAME}/${APP_INSTANCE_ID}/response/${RESPONSE_TYPE}

If a responseTopic is specified in the request, either in the payload or using MQTT V5's metadata (3.1.3.2.7. Response Topic), the reply will be published to that responseTopic instead.

Default:

wk/response/${RESPONSE_TYPE}

1.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

Keep response topic messages retained for new subscribers.

Default: false

2. Payload

All published events will contain the shared payload properties mentioned previously, as well as the following:

PropertyTypeDescription
responseTypestringThe type of response matching the request type, e.g. get_status.
requestMessageIdstring (nullable)if a messageId was provided in the request, it will be re-used here.
correlationDatastring (nullable)if provided in the request, either in the payload or using MQTT V5's metadata (3.1.3.2.7. Correlation Data), it will be present here in addition to the message's metadata.

2.1. Get Status

This response is published when a get_status request is received.

Example Payload:

{
  "responseType": "get_status",
  "messageId": "e3d50b37-febf-4289-86ff-bf2f5506fafc",
  "username": "medium-phone-api-35",
  "appInstanceId": "42188f0c-6784-4a52-95b6-8569f0f4d2f1",
  "requestMessageId": null,
  "correlationData": null,
  "data": {
    "currentUrl": "https://webviewkiosk.nktnet.uk",
    "isLocked": false,
    "lockStateType": "NONE",
    "lastInteractionTime": 1764695317211,
    "batteryPercentage": 62,
    "appBrightnessPercentage": -1,
    "systemBrightness": 255
  }
}

2.2. Get Settings

This response is published when a get_settings request is received.

The returned settings will depend on what was included in the request payload.

Example Payload:

{
  "responseType": "get_settings",
  "messageId": "887eb103-43c8-4306-b9cc-97f1e8499fe1",
  "username": "medium-phone-api-35",
  "appInstanceId": "42188f0c-6784-4a52-95b6-8569f0f4d2f1",
  "requestMessageId": null,
  "correlationData": null,
  "data": {
    "settings": {
      // Response settings depends on the request payload
      "appearance.theme": "SYSTEM",
      "device.rotation": "AUTO"
    }
  }
}

2.3. Get System Info

This response is published when a get_system_info request is received.

{
  "responseType": "get_system_info",
  "messageId": "154ec3ff-ff5a-49e6-9fa0-f6311e6893b8",
  "username": "medium-phone-api-35",
  "appInstanceId": "42188f0c-6784-4a52-95b6-8569f0f4d2f1",
  "requestMessageId": null,
  "correlationData": null,
  "data": {
    "app": {
      "name": "Webview Kiosk",
      "packageName": "uk.nktnet.webviewkiosk",
      "versionName": "0.25.0.12-mqtt-beta",
      "versionCode": 98,
      "minSdk": 21,
      "targetSdk": 36,
      "isDebug": true,
      "installer": null,
      "isDeviceOwner": false,
      "isLockTaskPermitted": true,
      "dhizukuPermissionGranted": true,
      "instanceId": "42188f0c-6784-4a52-95b6-8569f0f4d2f1"
    },
    "device": {
      "releaseVersion": "15",
      "sdkVersion": 35,
      "incrementalVersion": "12592187",
      "webViewVersion": "141.0.7390.122",
      "screenWidth": 1080,
      "screenHeight": 2400,
      "screenDensity": 2.625,
      "isManagedProfile": false,
      "timeZone": "Australia/Sydney",
      "locale": "en_US",
      "totalMemory": 2070986752,
      "totalStorage": 6228115456,
      "manufacturer": "Google",
      "model": "sdk_gphone64_arm64",
      "brand": "google",
      "device": "emu64a",
      "product": "sdk_gphone64_arm64",
      "hardware": "ranchu",
      "board": "goldfish_arm64",
      "bootloader": "unknown",
      "securityPatch": "2024-09-05",
      "supportedAbis": [
        "arm64-v8a"
      ],
      "supported32BitAbis": [],
      "supported64BitAbis": [
        "arm64-v8a"
      ],
      "buildFingerprint": "google/sdk_gphone64_arm64/emu64a:15/AE3A.240806.036/12592187:user/release-keys"
    }
  }
}

2.4. Error

This response is published whenever an error occurs with processing a request.

For example, the requestType could be invalid.

Example Payload:

{
  "responseType": "error",
  "messageId": "058a8f44-d34a-43b6-a7e7-8f5537cea62f",
  "username": "medium-phone-api-35",
  "appInstanceId": "42188f0c-6784-4a52-95b6-8569f0f4d2f1",
  "requestMessageId": null,
  "correlationData": null,
  "payloadStr": "{\n  \"requestType\": \"invalid\"\n}",
  "errorMessage": "Unexpected JSON token at offset 0: Serializer for subclass 'invalid' is not found in the polymorphic scope of 'MqttRequestMessage' at path: $\nCheck if class with serial name 'invalid' exists and serializer is registered in a corresponding SerializersModule.\nTo be registered automatically, class 'invalid' has to be '@Serializable', and the base class 'MqttRequestMessage' has to be sealed and '@Serializable'.\nJSON input: {\n  \"requestType\": \"invalid\"\n}"
}

On this page