@vention/machine-logic-ui-sdk 0.47.19 → 0.47.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Wrap the app once in `MqttProvider`. It opens one MQTT-over-websocket connection
|
|
|
21
21
|
- `version` defaults to `"v2"` and picks which broker address to derive, through `getMqttWsUrl`. On the edge both use an unencrypted websocket: `"v2"` connects to `192.168.5.2:9001` and `"v3"` connects to port `9001` on the host that serves the HMI. In the cloud iframe both use the same `wss://` URL: `wss://<the HMI's host><mqttPath>` when the host page gives an `mqttPath` query parameter that starts with `/`, else a URL derived from the iframe URL.
|
|
22
22
|
- `url` sets the broker websocket URL yourself. When set, `version` and the URL detection are skipped. Use it for standalone development, for example `ws://localhost:9001`.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Trimmed from a production HMI's `main.tsx`:
|
|
25
25
|
|
|
26
26
|
```tsx
|
|
27
27
|
import { StrictMode } from "react"
|
|
@@ -55,7 +55,7 @@ Read a topic with `useMqttSubscription`. It returns the latest message on that t
|
|
|
55
55
|
- Every payload goes through `JSON.parse`. Publish JSON on topics the HMI reads; a payload that is not valid JSON throws in the message handler. The type argument is an assertion, not a runtime check.
|
|
56
56
|
- Nothing subscribes until the provider's `connectionStatus` is `"connected"`. After a reconnect the hooks subscribe again.
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Trimmed from a production HMI's `operation-context.tsx`:
|
|
59
59
|
|
|
60
60
|
```tsx
|
|
61
61
|
import { useEffect, useState } from "react"
|