diff --git a/CHANGELOG.md b/CHANGELOG.md
index 38aa844a..9b28ca91 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,31 @@ Current framework simplification release train. Historical entries below describ
rejected invalid-candidate rollback, exact active revision retention, and a
fresh request through the retained JSON route.
+## FluxFlow.Components.Mqtt 7.1.0
+
+- Adds a provider-neutral `MqttBrokerTransport` choice and WebSocket path while
+ retaining the existing TLS flag and backward-compatible TCP default.
+- Validates TCP, TLS, `ws`, and `wss` broker definitions before provider
+ activation without host-platform detection or provider types.
+
+## FluxFlow.Components.Mqtt.Composition 7.1.0-rc.1
+
+- Adds exact portable `Transport` and `WebSocketPath` broker properties to C#
+ resource authoring and strict JSON binding.
+
+## FluxFlow.Components.Mqtt.MqttNet 3.1.0
+
+- Maps the neutral broker definition to MQTTnet TCP, TLS, WebSocket, and secure
+ WebSocket channels while preserving controller-owned lifecycle policy.
+
+## FluxFlow.Components.Mqtt.PulseMqtt 4.1.0
+
+- Updates the Pulse MQTT transport adapter and its test broker to stable Pulse
+ MQTT `2.29.0` and adds its matching WebSocket transport package.
+- Maps TCP, TLS, `ws`, and `wss` through Pulse's raw-client transport factories
+ while FluxFlow continues to own reconnect, subscriptions, acknowledgements,
+ and lifecycle policy.
+
## FluxFlow.Composition 7.0.0-rc.1
- Replaces split authoring/runtime declarations with complete typed
diff --git a/Directory.Packages.props b/Directory.Packages.props
index add12bde..b7486865 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -25,8 +25,9 @@
-
-
+
+
+
diff --git a/docs/14-public-api-overview.md b/docs/14-public-api-overview.md
index d6f6b3d4..a80249ab 100644
--- a/docs/14-public-api-overview.md
+++ b/docs/14-public-api-overview.md
@@ -443,10 +443,10 @@ The manifest is authoritative for shipped package identities and project-owned v
| `FluxFlow.Components.Http.AspNetCore` | `2.0.0` | runtime or support package |
| `FluxFlow.Engine` | `7.0.0` | unified hosted application lifecycle, revisions, stable ports, and diagnostics |
| `FluxFlow.Engine.HealthChecks` | `1.0.0` | optional standard .NET readiness check over existing Engine application state |
-| `FluxFlow.Components.Mqtt` | `7.0.0` | runtime or support package |
-| `FluxFlow.Components.Mqtt.Composition` | `6.0.0` | `AddMqtt`; `MqttComponentDefinition`; revision-owned MQTT controllers over host resources |
-| `FluxFlow.Components.Mqtt.MqttNet` | `3.0.0` | runtime or support package |
-| `FluxFlow.Components.Mqtt.PulseMqtt` | `4.0.0` | runtime or support package |
+| `FluxFlow.Components.Mqtt` | `7.1.0` | neutral TCP, TLS, WebSocket, and secure WebSocket MQTT orchestration |
+| `FluxFlow.Components.Mqtt.Composition` | `7.1.0-rc.1` | `MqttComponentDefinition`; portable MQTT resources and complete code-first contracts over revision-owned controllers |
+| `FluxFlow.Components.Mqtt.MqttNet` | `3.1.0` | MQTTnet transport adapter for the neutral broker modes |
+| `FluxFlow.Components.Mqtt.PulseMqtt` | `4.1.0` | Pulse MQTT 2.29 raw-client adapter for the neutral broker modes |
| `FluxFlow.Components.Mapping` | `6.0.0` | runtime or support package |
| `FluxFlow.Components.Mapping.Composition` | `6.0.0` | `AddMapping`; `MappingComponentDefinition` |
| `FluxFlow.Components.Assertions` | `6.0.0` | runtime or support package |
diff --git a/docs/21-component-type-names.md b/docs/21-component-type-names.md
index 8b01186a..a44de08d 100644
--- a/docs/21-component-type-names.md
+++ b/docs/21-component-type-names.md
@@ -18,7 +18,11 @@ are nouns because they describe reusable configuration or host-owned state:
"Resources": {
"Broker1": {
"Type": "mqtt.broker",
- "Host": "broker.example.net"
+ "Host": "broker.example.net",
+ "Port": 443,
+ "Transport": "WebSocket",
+ "UseTls": true,
+ "WebSocketPath": "/mqtt"
},
"Client1": {
"Type": "mqtt.client",
@@ -85,6 +89,11 @@ same runtime surface.
| `mqtt.subscription` | Reusable MQTT subscription settings. |
| `retry.policy` | Reusable reconnect policy. |
+An `mqtt.broker` combines `Transport` (`Tcp` or `WebSocket`) and `UseTls` to
+describe TCP, TLS, `ws`, or `wss` without naming a concrete provider. Existing
+definitions default to TCP when `Transport` is omitted. WebSocket definitions
+may set `WebSocketPath`, which defaults to `/mqtt`.
+
Hosts may define additional resource types. Their names follow the same
`domain.kind` rule and remain host contracts rather than component-owned
resources.
diff --git a/eng/public-api/baseline.txt b/eng/public-api/baseline.txt
index c1bff37e..f4ed8cd4 100644
--- a/eng/public-api/baseline.txt
+++ b/eng/public-api/baseline.txt
@@ -11,8 +11,8 @@
7|45|5668E1862A4D74837DE5E98809BB1B7F5120EACD5F719263CAFFA574D79EED13
8|30|2C68BF45E40E57070F67FE5EBA6B34FE7D01F68CA7B1EAB7D73563AFEF8BC020
9|433|F2F47F95CFE57CA455C2D966BC4D387C18425694E1AFC07E536CD492754673CE
-10|304|CCB4B470C89172BFC6E5C4678281685B8798A93D4103CE16A3BF739A3A08FD57
-11|181|90B27C5864451400ED2D6DA7662B31C08AE8C419D1E2D585633C32645FA2BD65
+10|307|2284E41590D6353503EC03CD6F25A507227A52BE7EE9272C0DA930FA7BB06F97
+11|185|542E9A189E96F09856F1B863918159958C8E34F2048A4458C5C1362514E54239
12|16|D293AE12ACD7A232FBD1F638DDED6D55A12ABC7A5261B62F3D4B897EAABF13CB
13|16|E1C6A089B6EE1988D24836D78EDBB68BB51FB540D3DFF0AB6BEF1DBB1A7DB952
14|32|D86ED4710E121B0E7BCF6D0314D404CF5B5349F6313370A770003C78397A77A4
diff --git a/goals/2026-08-09-portable-mqtt-websocket-transport/README.md b/goals/2026-08-09-portable-mqtt-websocket-transport/README.md
new file mode 100644
index 00000000..74d404d5
--- /dev/null
+++ b/goals/2026-08-09-portable-mqtt-websocket-transport/README.md
@@ -0,0 +1,219 @@
+# Goal: Add portable TCP, TLS, WebSocket, and secure WebSocket MQTT transport selection
+
+Date: 2026-08-09
+
+Status: completed successfully
+
+## Objective
+
+Extend FluxFlow's provider-neutral MQTT broker configuration so the same C#
+and portable JSON application definitions can explicitly select ordinary TCP,
+TLS over TCP, MQTT over WebSocket (`ws`), or MQTT over secure WebSocket
+(`wss`). Map that one neutral configuration through both official adapters:
+Pulse MQTT and MQTTnet.
+
+Keep the design small and explicit. Do not expose provider types, add
+reflection, create a custom transport catalog, or duplicate lifecycle policy.
+FluxFlow remains the sole owner of connection, reconnect, subscription,
+acknowledgement, event, and disposal behavior.
+
+## Frozen public configuration contract
+
+Use two independent, readable facts instead of four partially duplicated
+flags or provider-specific options:
+
+1. Add public enum `MqttBrokerTransport` with exactly:
+ - `Tcp`;
+ - `WebSocket`.
+2. Add `MqttBrokerConfiguration.Transport`, defaulting to
+ `MqttBrokerTransport.Tcp`.
+3. Keep the existing `MqttBrokerConfiguration.UseTls` flag:
+ - `Tcp` + `false` means plain TCP;
+ - `Tcp` + `true` means TLS over TCP;
+ - `WebSocket` + `false` means `ws`;
+ - `WebSocket` + `true` means `wss`.
+4. Add `MqttBrokerConfiguration.WebSocketPath`, defaulting to `/mqtt`.
+5. Preserve the existing immutable `sealed record` with `init` properties,
+ including `Host`, `Port`, `UseTls`, and `ServerName`.
+6. Preserve old C# and JSON definitions: omitting `Transport` must continue to
+ produce the existing TCP behavior, and all existing TCP/TLS examples and
+ applications must remain valid.
+7. The transport enum must serialize and deserialize by its stable string name
+ in portable MQTT resource definitions.
+
+## Validation and endpoint rules
+
+Apply transport-neutral validation once in the MQTT core before a provider
+session is used:
+
+- `Transport` must be a defined enum value.
+- `Host` and `Port` keep their existing validation.
+- For WebSocket transport, `WebSocketPath` must be non-empty, begin with `/`,
+ and represent a path only; reject fragments and query text in this round.
+- `ServerName` remains the TLS target-host override for TCP/TLS.
+- Reject a `ServerName` override for WebSocket transport because the two
+ providers cannot map an independent WebSocket SNI/target-host override with
+ equivalent portable semantics. `wss` uses `Host` as its TLS host.
+- Build WebSocket endpoints with `UriBuilder` so host, port, path, IPv6, and
+ escaping are handled predictably.
+- Keep MQTT's WebSocket subprotocol fixed to the standard `mqtt` value.
+- Preserve existing certificate validation/loading. When a provider supports
+ WebSocket client certificates, map the already-resolved FluxFlow certificate
+ collection without exposing provider configuration callbacks.
+
+## Core and composition changes
+
+1. Add the enum and new immutable broker properties to
+ `FluxFlow.Components.Mqtt`.
+2. Extend `MqttBrokerResourceBuilder` with `Transport` and `WebSocketPath`.
+3. Add the exact portable resource property names `Transport` and
+ `WebSocketPath` to `MqttComponentDefinition.ResourceProperties`.
+4. Allow those properties in `MqttCompositionResourceRegistrar` and bind them
+ through the existing explicit `System.Text.Json` converter.
+5. Keep JSON property validation strict: misspelled or provider-specific
+ transport properties remain rejected.
+6. Update C# authoring and JSON examples for both TCP/TLS and WebSocket/WSS.
+7. Do not add another registration method, factory abstraction, resource type,
+ or callback layer.
+
+## Pulse MQTT adapter
+
+1. Centrally pin `Pulse.Mqtt.Transport.WebSocket` to stable `2.29.0`, matching
+ `Pulse.Mqtt.Client` and `Pulse.Mqtt.Testing`.
+2. Reference that package only from `FluxFlow.Components.Mqtt.PulseMqtt`.
+3. Keep `RawMqttClient`; do not construct Pulse's resilient or hosted client.
+4. Keep the optional advanced provider transport-factory injection unchanged.
+5. When no provider factory is injected:
+ - create `TcpTransportFactory` for `Tcp`;
+ - create `WebSocketTransportFactory` for `WebSocket`;
+ - use `ws` or `wss` from `UseTls`;
+ - use the configured host, port, and WebSocket path;
+ - use subprotocol `mqtt`;
+ - apply already-loaded client certificates to WebSocket client options
+ when present.
+6. Preserve exact message bytes, protocol properties, cancellation,
+ acknowledgement mapping, reconnect ownership, and deterministic disposal.
+
+## MQTTnet adapter
+
+1. Continue using the current centrally pinned MQTTnet package.
+2. Build TCP channel options for `Tcp` and WebSocket channel options for
+ `WebSocket` from the same neutral configuration.
+3. Apply TLS for TCP through the existing TLS options; use an explicit `wss`
+ endpoint for secure WebSocket and map the same certificate collection into
+ the WebSocket TLS options supported by MQTTnet.
+4. Preserve credentials, client identity, clean start, keep alive, connect
+ timeout, Last Will, MQTT v5 properties, acknowledgement behavior,
+ cancellation, and disposal.
+5. Do not add MQTTnet types to any core, composition, definition, or public
+ authoring surface.
+
+## Package versions and metadata
+
+These are additive public capabilities on already-published packages:
+
+- `FluxFlow.Components.Mqtt`: `7.0.0` -> `7.1.0`;
+- `FluxFlow.Components.Mqtt.Composition`: `7.0.0-rc.1` -> `7.1.0-rc.1`;
+- `FluxFlow.Components.Mqtt.MqttNet`: `3.0.0` -> `3.1.0`;
+- `FluxFlow.Components.Mqtt.PulseMqtt`: supersede the local, unpublished
+ `4.0.1` dependency-only revision with `4.1.0`.
+
+Update package release notes, package overview documentation, package
+manifests or version assertions that describe the current source versions,
+and the repository changelog. Keep binary/API comparison baselines pointing to
+the last published versions where those baselines intentionally represent the
+release comparison source.
+
+## Documentation and host guidance
+
+Document one compact decision table and examples:
+
+| Transport | UseTls | Result |
+| --- | --- | --- |
+| `Tcp` | `false` | TCP |
+| `Tcp` | `true` | TLS |
+| `WebSocket` | `false` | `ws` |
+| `WebSocket` | `true` | `wss` |
+
+State clearly:
+
+- browser-hosted applications must use `WebSocket` and normally `wss`;
+- desktop, service, and server hosts may use all four combinations;
+- WebAssembly hosts must validate or hide unsupported native-only options such
+ as client-certificate loading rather than silently ignoring them;
+- browser capability policy belongs to the host application, not to provider
+ detection or runtime magic in the MQTT core;
+- advanced proxy headers, custom WebSocket subprotocols, signed query strings,
+ QUIC, and provider callbacks remain advanced provider concerns outside this
+ portable round.
+
+Update the MQTT core, composition, Pulse adapter, and MQTTnet adapter READMEs,
+the documentation site package overview, repository memory index, and progress
+log. Add a new numbered memory record with the exact decisions and verification
+results.
+
+## Tests and verification
+
+Use the existing xUnit/Shouldly projects and focused package/release gates.
+Tests must prove behavior rather than only source presence.
+
+Required evidence:
+
+1. Core validation covers all four combinations, undefined transport,
+ malformed WebSocket paths, and unsupported WebSocket `ServerName` override.
+2. Existing configurations without `Transport` still validate and use TCP.
+3. Composition C# authoring emits exact `Transport` and `WebSocketPath`
+ properties, and JSON binding resolves the exact enum/path values.
+4. Portable JSON rejects unknown transport properties and invalid enum values.
+5. Pulse adapter construction selects the exact TCP or WebSocket provider
+ factory, builds exact `ws`/`wss` URI values, uses `mqtt` subprotocol, and
+ maps certificates without running a real broker.
+6. MQTTnet adapter builds exact TCP/TLS/ws/wss channel options, including host,
+ port, path, TLS target/certificates where supported, without a real broker.
+7. Shared adapter conformance remains green and no provider type crosses the
+ neutral public boundary.
+8. Existing controller, reconnect, subscriptions, acknowledgements, events,
+ and lifecycle tests remain green.
+9. Focused Release conventions protect the public enum/property shape,
+ provider-neutral source boundary, package dependency, versions, and docs.
+10. Restore/build all affected projects for `net8.0` and `net10.0` through
+ their multi-targeted package projects with zero warnings.
+11. Run focused test projects:
+ - `FluxFlow.Components.Mqtt.Tests`;
+ - `FluxFlow.Components.Mqtt.Composition.Tests`;
+ - `FluxFlow.Components.Mqtt.PulseMqtt.Tests`;
+ - `FluxFlow.Components.Mqtt.MqttNet.Tests`;
+ - `FluxFlow.Components.Mqtt.Adapters.Tests`;
+ - focused `FluxFlow.Release.Tests` MQTT/package/documentation facts.
+12. Run release preflight for the four changed FluxFlow MQTT packages.
+13. Pack the two adapter packages into an isolated temporary output and inspect
+ their dependency groups:
+ - Pulse adapter requires Pulse client and WebSocket transport `2.29.0`;
+ - MQTTnet adapter retains its intended MQTTnet dependency;
+ - both require the updated neutral MQTT core version.
+14. Run scoped formatting, whitespace, and `git diff --check` checks.
+
+## Explicit exclusions
+
+- No Pulse resilient client, Pulse dependency-injection host, Pulse health
+ checks, Pulse router, or Pulse durable store integration.
+- No QUIC transport.
+- No custom WebSocket headers, proxy model, alternate subprotocol, query-string
+ model, or provider callback in portable configuration.
+- No reflection, dynamic provider discovery, custom catalog, or service-locator
+ behavior.
+- No duplicate reconnect, retry, subscription, acknowledgement, or lifecycle
+ owner.
+- No direct JavaScript, browser interop, or host-platform detection in the MQTT
+ packages.
+- No package publication, tag, release dispatch, or feed mutation.
+- No unrelated framework, Fluent DSL, storage, health, or UI refactoring.
+
+## Completion criteria
+
+The goal is complete when existing TCP/TLS definitions remain compatible, the
+new neutral configuration expresses WebSocket/WSS without provider types, both
+official adapters map all four transport combinations correctly, FluxFlow
+remains the sole lifecycle owner, all focused tests/builds/package inspections
+pass with zero warnings, documentation and memory are current, and no excluded
+complexity or publication action has been introduced.
diff --git a/goals/2026-08-09-pulsemqtt-2-29-upgrade/README.md b/goals/2026-08-09-pulsemqtt-2-29-upgrade/README.md
new file mode 100644
index 00000000..4ce5cd09
--- /dev/null
+++ b/goals/2026-08-09-pulsemqtt-2-29-upgrade/README.md
@@ -0,0 +1,106 @@
+# Goal: Upgrade the FluxFlow Pulse MQTT adapter to Pulse MQTT 2.29
+
+Date: 2026-08-09
+
+Status: completed successfully
+
+## Objective
+
+Upgrade FluxFlow's Pulse MQTT provider integration from the currently pinned
+stable Pulse MQTT `2.5.0` packages to the current stable `2.29.0` packages
+without changing FluxFlow's public MQTT contracts, lifecycle ownership,
+portable definitions, or provider-neutral behavior.
+
+The result must keep FluxFlow as the single owner of MQTT connection policy and
+workflow behavior while using Pulse only for the raw protocol and transport
+session implementation.
+
+## Required changes
+
+1. Update the centrally managed versions of:
+ - `Pulse.Mqtt.Client` from `2.5.0` to `2.29.0`;
+ - `Pulse.Mqtt.Testing` from `2.5.0` to `2.29.0`.
+2. Move `FluxFlow.Components.Mqtt.PulseMqtt` from the already-published
+ `4.0.0` package to the additive patch version `4.0.1`, so package consumers
+ can receive the new dependency baseline.
+3. Restore the affected projects from the configured NuGet sources and verify
+ that the exact stable `2.29.0` assets resolve.
+4. Compile the existing `FluxFlow.Components.Mqtt.PulseMqtt` adapter against
+ the new dependency.
+5. Apply only source migrations required by real Pulse API or behavior changes.
+ Do not redesign the adapter speculatively.
+6. Preserve the raw-client integration. The adapter must continue using
+ Pulse's `RawMqttClient`; it must not register or construct Pulse's hosted
+ resilient client.
+7. Update package release notes, the repository changelog, current
+ documentation, and repository memory so the dependency baseline and
+ ownership decision are explicit.
+
+## Preserved behavior
+
+- `MqttClientController` owns start, stop, reconnect, retry classification,
+ desired-subscription restoration, events, and disposal.
+- FluxFlow owns workflow acknowledgement timing and delivery handoff.
+- The Pulse transport session remains non-resilient and provider-specific only
+ behind `IMqttTransportFactory` and `IMqttTransportSession`.
+- Exact payload bytes, MQTT properties, subscriptions, Last Will, credentials,
+ certificates, protocol failures, and broker acknowledgement mapping remain
+ unchanged unless a verified upstream correction requires a focused update.
+- Cancellation and deterministic disposal remain part of the adapter contract.
+- No Pulse type enters portable JSON, component contracts, application
+ definitions, typed ports, the MQTT core package, or consumer-facing workflow
+ APIs.
+
+## Explicit exclusions
+
+- Do not add WebSocket transport selection to `MqttBrokerConfiguration` in this
+ round.
+- Do not add `Pulse.Mqtt.Transport.WebSocket`, QUIC, Pulse dependency-injection,
+ Pulse health checks, Pulse routing, or Pulse durable stores.
+- Do not replace FluxFlow reconnect or subscription ownership with Pulse's
+ resilient-client layer.
+- Do not change the MQTTnet adapter or its package version.
+- Do not change any other FluxFlow package version or public API for this
+ dependency update.
+- Do not publish packages, create tags, dispatch release workflows, or write to
+ a package feed.
+
+## Verification plan
+
+Use the repository's existing xUnit/Shouldly tests; add a new test only if the
+upgrade exposes an uncovered behavioral contract.
+
+Required gates:
+
+1. Restore the Pulse adapter test project with zero restore errors or warnings.
+2. Build `FluxFlow.Components.Mqtt.PulseMqtt` in Release with zero errors and
+ warnings.
+3. Run `FluxFlow.Components.Mqtt.PulseMqtt.Tests` in Release.
+4. Run `FluxFlow.Components.Mqtt.Adapters.Tests` in Release so Pulse and
+ MQTTnet still satisfy the same neutral conformance contract.
+5. Run `FluxFlow.Components.Mqtt.Tests` in Release to protect controller,
+ reconnect, subscription, acknowledgement, and ownership semantics.
+6. Run package release preflight for `components-mqtt-pulsemqtt` `4.0.1`.
+7. Pack `FluxFlow.Components.Mqtt.PulseMqtt` `4.0.1` into a temporary isolated
+ output and verify its generated dependency metadata requires Pulse MQTT
+ `2.29.0`.
+8. Run scoped formatting/whitespace checks and `git diff --check`.
+
+## Documentation and memory
+
+- Add an Unreleased changelog entry describing the dependency update and the
+ unchanged ownership boundary.
+- Update the Pulse adapter README with the tested provider baseline.
+- Add a new numbered memory entry containing the exact changes, verification
+ results, and remaining WebSocket follow-up.
+- Add the memory entry to `memory/00-index.md` and append a concise result to
+ `memory/07-progress-log.md`.
+
+## Completion criteria
+
+The goal is complete when the exact stable Pulse MQTT `2.29.0` client/testing
+packages are restored, the adapter and all three focused MQTT suites pass with
+zero warnings, package `4.0.1` passes preflight, the packed adapter declares the
+expected dependency, all scoped hygiene checks pass, documentation and memory
+are current, and no excluded runtime or public-surface change has been
+introduced.
diff --git a/memory/00-index.md b/memory/00-index.md
index 3fd3b855..945fd156 100644
--- a/memory/00-index.md
+++ b/memory/00-index.md
@@ -790,6 +790,13 @@ This folder records the extraction work for `FluxFlow.Engine`.
of all 31 prereleases, trusted short-lived upload, exact public/release asset
verification, standalone public-feed pilot evidence, and the deferred stable
promotion boundary.
+- `308-pulsemqtt-2-29-upgrade.md`: Pulse MQTT client/testing dependencies moved
+ from `2.5.0` to stable `2.29.0` with the raw-client ownership boundary,
+ adapter/core/conformance verification, package metadata proof, and explicit
+ WebSocket follow-up preserved.
+- `309-portable-mqtt-websocket-transport.md`: provider-neutral TCP, TLS, `ws`,
+ and `wss` broker configuration, strict path/SNI validation, Pulse and MQTTnet
+ adapter mapping, browser host boundary, and package verification.
- `report.md`: original FluxMq migration spike report supplied for review.
- `legacy-docs/`: historical pre-cleanup docs; current decisions override older
API descriptions in this folder.
diff --git a/memory/07-progress-log.md b/memory/07-progress-log.md
index 8fd3ff29..444080bd 100644
--- a/memory/07-progress-log.md
+++ b/memory/07-progress-log.md
@@ -3056,3 +3056,37 @@ Date: 2026-08-02
consumer loads, and local-feed verifications. All temporary artifacts were
removed, and no tag, release, publication, feed write, or release workflow
dispatch occurred. See [[291-pr-65-merge-and-post-merge-validation]].
+
+## 2026-08-09 - Pulse MQTT 2.29 Dependency Upgrade
+
+- Moved `Pulse.Mqtt.Client` and `Pulse.Mqtt.Testing` from stable `2.5.0` to
+ stable `2.29.0` and moved the already-published Pulse adapter from `4.0.0` to
+ additive `4.0.1`, without changing FluxFlow public API or runtime source.
+- Preserved the `RawMqttClient` transport boundary: FluxFlow still owns
+ reconnect, desired subscriptions, workflow acknowledgement, events, and
+ disposal.
+- Exact restore and Release adapter build passed with zero warnings. Focused
+ Pulse adapter, shared adapter-conformance, and MQTT core suites passed 6/6,
+ 7/7, and 54/54 respectively.
+- Release preflight passed for `components-mqtt-pulsemqtt` `4.0.1`. A temporary
+ package proved an exact `Pulse.Mqtt.Client` `2.29.0` dependency for both
+ `net8.0` and `net10.0`, then the owned output was removed. WebSocket transport
+ configuration remains a separate feature round. See
+ [[308-pulsemqtt-2-29-upgrade]].
+
+## 2026-08-09 - Portable MQTT WebSocket Transport
+
+- Added one neutral `MqttBrokerTransport` choice plus the existing `UseTls`
+ flag to cover TCP, TLS, `ws`, and `wss`; existing definitions still default
+ to TCP and WebSocket paths default to `/mqtt`.
+- Mapped the same immutable configuration through Pulse MQTT raw transports
+ and MQTTnet channels without provider types, reflection, platform detection,
+ or a second lifecycle owner.
+- Added strict portable validation for transport values, path-only WebSocket
+ endpoints, TCP-only custom server names, and string-only JSON enums. Focused
+ core, composition, provider, conformance, and governance suites passed
+ 132/132 combined with zero warnings.
+- All four package preflights passed. Isolated adapter packages proved exact
+ `net8.0`/`net10.0` dependencies, including Pulse WebSocket `2.29.0`, and the
+ verified temporary output was removed. No publication occurred. See
+ [[309-portable-mqtt-websocket-transport]].
diff --git a/memory/308-pulsemqtt-2-29-upgrade.md b/memory/308-pulsemqtt-2-29-upgrade.md
new file mode 100644
index 00000000..af45e3fa
--- /dev/null
+++ b/memory/308-pulsemqtt-2-29-upgrade.md
@@ -0,0 +1,79 @@
+# 308 - Pulse MQTT 2.29 dependency upgrade
+
+Date: 2026-08-09
+
+Status: complete on local `main`; not published
+
+## Decision
+
+Upgrade the FluxFlow Pulse MQTT transport adapter from stable Pulse MQTT
+`2.5.0` to stable `2.29.0`:
+
+- `Pulse.Mqtt.Client` `2.5.0` -> `2.29.0`;
+- `Pulse.Mqtt.Testing` `2.5.0` -> `2.29.0`.
+
+Move the already-published FluxFlow adapter package from `4.0.0` to additive
+patch `4.0.1`, making the dependency update consumable without changing public
+API.
+
+Keep the existing provider-neutral architecture. FluxFlow continues to use
+Pulse's `RawMqttClient` behind `IMqttTransportFactory` and
+`IMqttTransportSession`; it does not use Pulse's resilient hosted client,
+dependency-injection lifecycle, routing, health, or durable stores.
+
+## Findings
+
+Pulse MQTT's post-2.0 semantic-version policy makes minor releases additive.
+The current FluxFlow adapter compiled against `2.29.0` without a production
+source migration. Existing raw-client, acknowledged-message, completion,
+server-disconnect, topic-filter, and transport-factory APIs remained compatible.
+
+This confirms the dependency upgrade does not change responsibility:
+
+- FluxFlow owns reconnect and retry classification;
+- FluxFlow owns desired subscriptions and restoration;
+- FluxFlow owns workflow acknowledgement timing and message handoff;
+- FluxFlow owns events, resource lifetime, and deterministic disposal;
+- Pulse owns raw MQTT protocol and transport behavior inside its adapter.
+
+## Changes
+
+- Updated the two central Pulse MQTT package pins to `2.29.0`.
+- Updated `FluxFlow.Components.Mqtt.PulseMqtt` from `4.0.0` to `4.0.1` because
+ `4.0.0` is already published on NuGet.
+- Updated the Pulse adapter package release notes.
+- Documented the tested provider baseline in the adapter README.
+- Added an Unreleased changelog entry.
+- Recorded the executable scope in
+ `goals/2026-08-09-pulsemqtt-2-29-upgrade/README.md`.
+
+No other FluxFlow package version, public declaration, runtime source, MQTTnet
+dependency, portable JSON contract, or application/component DSL changed.
+
+## Verification
+
+- Targeted restore resolved exact `Pulse.Mqtt.Client/2.29.0` and
+ `Pulse.Mqtt.Testing/2.29.0` assets with zero errors or warnings.
+- Release adapter build passed: 5 projects, 0 errors, 0 warnings.
+- `FluxFlow.Components.Mqtt.PulseMqtt.Tests` passed: 6/6, 0 warnings.
+- `FluxFlow.Components.Mqtt.Adapters.Tests` passed: 7/7, 0 warnings.
+- `FluxFlow.Components.Mqtt.Tests` passed: 54/54, 0 warnings.
+- Package release preflight passed for `components-mqtt-pulsemqtt` `4.0.1`.
+- A temporary Release package `4.0.1` was created successfully for `net8.0`
+ and `net10.0`. Its generated nuspec required `Pulse.Mqtt.Client` `2.29.0` in
+ both target-framework groups and retained the neutral
+ `FluxFlow.Components.Mqtt` dependency.
+- The temporary package output was removed after inspection.
+- Scoped repository hygiene and formatting checks completed after the final
+ documentation update.
+
+No full-solution test, publication, tag, feed write, release workflow, or
+external deployment was performed.
+
+## Follow-up
+
+WebSocket transport selection remains a separate feature round. It should add
+an explicit portable transport choice to the neutral FluxFlow MQTT broker
+configuration and map that choice in provider adapters. This dependency-only
+upgrade intentionally does not add `Pulse.Mqtt.Transport.WebSocket` or change
+the current TCP/TLS configuration surface.
diff --git a/memory/309-portable-mqtt-websocket-transport.md b/memory/309-portable-mqtt-websocket-transport.md
new file mode 100644
index 00000000..cd5bf714
--- /dev/null
+++ b/memory/309-portable-mqtt-websocket-transport.md
@@ -0,0 +1,85 @@
+# Portable MQTT WebSocket Transport
+
+Date: 2026-08-09
+
+## Decision
+
+FluxFlow represents the four portable MQTT broker modes with two orthogonal
+configuration facts:
+
+- `MqttBrokerTransport` selects `Tcp` or `WebSocket`;
+- the existing `UseTls` selects plain or secure transport.
+
+This produces TCP, TLS over TCP, `ws`, and `wss` without provider types or four
+overlapping flags. `Transport` defaults to `Tcp`, preserving existing C# and
+JSON behavior. `WebSocketPath` defaults to `/mqtt`.
+
+## Validation boundary
+
+- Undefined transport values are rejected before provider activation.
+- WebSocket paths must be rooted and contain no query or fragment.
+- A custom WebSocket path is rejected for TCP rather than silently ignored.
+- `ServerName` remains a TCP/TLS override and is rejected for WebSocket because
+ the providers do not expose equivalent portable SNI override behavior.
+- Browser capability rules remain host policy. The neutral core does not use
+ platform detection or silently remove native-only settings.
+
+## Adapter mapping
+
+- The Pulse adapter uses `TcpTransportFactory` or
+ `WebSocketTransportFactory` from Pulse MQTT `2.29.0` and continues to create
+ `RawMqttClient`. FluxFlow remains the reconnect, subscription,
+ acknowledgement, and lifecycle owner.
+- The MQTTnet adapter selects TCP or WebSocket channel options from the same
+ neutral broker record and applies TLS/certificates through MQTTnet's channel
+ options.
+- The Pulse WebSocket package is referenced by the Pulse adapter only. No
+ provider type enters core configuration, composition, portable JSON, or
+ component contracts.
+
+## Package line
+
+- `FluxFlow.Components.Mqtt` `7.1.0`
+- `FluxFlow.Components.Mqtt.Composition` `7.1.0-rc.1`
+- `FluxFlow.Components.Mqtt.MqttNet` `3.1.0`
+- `FluxFlow.Components.Mqtt.PulseMqtt` `4.1.0`
+
+The prior local Pulse `4.0.1` dependency-only revision was not published and is
+superseded by the additive `4.1.0` transport feature.
+
+## Verification
+
+Initial multi-targeted Release builds for the Pulse adapter, MQTTnet adapter,
+MQTT composition package, and MQTT sample completed with zero errors and zero
+warnings.
+
+Focused xUnit/Shouldly results:
+
+- MQTT core: 68/68;
+- MQTT composition: 33/33, including the strengthened 3/3 invalid string and
+ numeric enum cases;
+- Pulse adapter: 10/10;
+- MQTTnet adapter: 12/12;
+- shared adapter conformance: 7/7;
+- Release governance: 2/2.
+
+All final runs reported zero warnings. The tests exposed and drove two concrete
+corrections: typed C# authoring now emits transport names rather than enum
+numbers, and portable MQTT JSON now disables integer enum values.
+
+Release preflight passed for all four changed packages. Isolated `net8.0` and
+`net10.0` adapter packages proved exact dependencies:
+
+- Pulse adapter `4.1.0`: MQTT core `7.1.0`, Pulse client `2.29.0`, and Pulse
+ WebSocket transport `2.29.0`;
+- MQTTnet adapter `3.1.0`: MQTT core `7.1.0` and MQTTnet `5.1.0.1559`.
+
+The temporary package directory was verified inside the system temporary root
+and removed after inspection. Scoped formatting, whitespace, and diff checks
+passed. No package was published and no release action was dispatched.
+
+## Exclusions
+
+This round does not add QUIC, provider discovery, reflection, custom catalogs,
+WebSocket headers/proxies/query strings, alternate subprotocols, browser
+interop, or a second MQTT lifecycle owner.
diff --git a/samples/FluxFlow.MqttCompositionSample/Program.cs b/samples/FluxFlow.MqttCompositionSample/Program.cs
index f46e6436..f7c3bdea 100644
--- a/samples/FluxFlow.MqttCompositionSample/Program.cs
+++ b/samples/FluxFlow.MqttCompositionSample/Program.cs
@@ -59,7 +59,10 @@ static async Task> RunDefinitionApplicationAsy
broker =>
{
broker.Host = "localhost";
- broker.Port = 1883;
+ broker.Port = 443;
+ broker.Transport = MqttBrokerTransport.WebSocket;
+ broker.UseTls = true;
+ broker.WebSocketPath = "/mqtt";
},
out var broker)
.AddMqttRetryPolicy("retry", out var retry)
diff --git a/samples/FluxFlow.MqttCompositionSample/README.md b/samples/FluxFlow.MqttCompositionSample/README.md
index 3fcbd111..975c5573 100644
--- a/samples/FluxFlow.MqttCompositionSample/README.md
+++ b/samples/FluxFlow.MqttCompositionSample/README.md
@@ -12,6 +12,8 @@ The sample uses:
remain inactive so the sample needs no network broker
- the same canonical application shape through JSON and the chain-first C#
authoring style
+- the portable `WebSocket` + `UseTls` broker shape for WSS, with no provider
+ type in either definition path
```text
source.Output -> outbound.Input
diff --git a/samples/FluxFlow.MqttCompositionSample/appsettings.json b/samples/FluxFlow.MqttCompositionSample/appsettings.json
index acd8ba76..88a12e65 100644
--- a/samples/FluxFlow.MqttCompositionSample/appsettings.json
+++ b/samples/FluxFlow.MqttCompositionSample/appsettings.json
@@ -4,7 +4,10 @@
"broker": {
"Type": "mqtt.broker",
"Host": "localhost",
- "Port": 1883
+ "Port": 443,
+ "Transport": "WebSocket",
+ "UseTls": true,
+ "WebSocketPath": "/mqtt"
},
"commands": {
"Type": "mqtt.subscription",
diff --git a/src/FluxFlow.Engine/Internal/ConfigurationJsonReader.cs b/src/FluxFlow.Engine/Internal/ConfigurationJsonReader.cs
index 7be9f3b0..69ae7bb3 100644
--- a/src/FluxFlow.Engine/Internal/ConfigurationJsonReader.cs
+++ b/src/FluxFlow.Engine/Internal/ConfigurationJsonReader.cs
@@ -43,6 +43,9 @@ internal static class ConfigurationJsonReader
if (value is null)
return null;
+ if (bool.TryParse(value, out var boolean))
+ return JsonValue.Create(boolean);
+
try
{
return JsonNode.Parse(value);
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/Authoring/MqttResourceAuthoring.cs b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/Authoring/MqttResourceAuthoring.cs
index a6c6ee36..77b55f6e 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/Authoring/MqttResourceAuthoring.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/Authoring/MqttResourceAuthoring.cs
@@ -34,8 +34,10 @@ public sealed class MqttBrokerResourceBuilder
{
public string? Host { get; set; }
public int? Port { get; set; }
+ public MqttBrokerTransport? Transport { get; set; }
public bool? UseTls { get; set; }
public string? ServerName { get; set; }
+ public string? WebSocketPath { get; set; }
internal void Apply(ResourceDefinitionBuilder definition)
{
@@ -44,8 +46,15 @@ internal void Apply(ResourceDefinitionBuilder definition)
definition.Set(MqttComponentDefinition.ResourceProperties.Host, Host);
SetIfPresent(definition, MqttComponentDefinition.ResourceProperties.Port, Port);
+ if (Transport is { } transport)
+ {
+ definition.Set(
+ MqttComponentDefinition.ResourceProperties.Transport,
+ transport.ToString());
+ }
SetIfPresent(definition, MqttComponentDefinition.ResourceProperties.UseTls, UseTls);
SetIfPresent(definition, MqttComponentDefinition.ResourceProperties.ServerName, ServerName);
+ SetIfPresent(definition, MqttComponentDefinition.ResourceProperties.WebSocketPath, WebSocketPath);
}
private static void SetIfPresent(ResourceDefinitionBuilder definition, string name, T? value)
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/FluxFlow.Components.Mqtt.Composition.csproj b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/FluxFlow.Components.Mqtt.Composition.csproj
index 5f0a09a6..b822fa37 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/FluxFlow.Components.Mqtt.Composition.csproj
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/FluxFlow.Components.Mqtt.Composition.csproj
@@ -5,11 +5,11 @@
FluxFlow.Components.Mqtt.Composition
FluxFlow.Components.Mqtt.Composition
FluxFlow.Components.Mqtt.Composition
- 7.0.0-rc.1
+ 7.1.0-rc.1
Canonical FluxFlow Composition resources and nodes for provider-neutral MQTT client control, publication, subscriptions, and client events.
workflow;dataflow;components;mqtt;composition
README.md
- Requires canonical MQTT types and retry.policy; registers through the flat designed-component API and maps trigger subscriptions explicitly without changing resource or controller lifecycle semantics.
+ Adds portable TCP, TLS, WebSocket, and secure WebSocket broker resource authoring while preserving strict JSON validation and controller lifecycle semantics.
true
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttComponentDefinition.cs b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttComponentDefinition.cs
index 4be2b38b..074a2ab8 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttComponentDefinition.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttComponentDefinition.cs
@@ -25,8 +25,10 @@ public static class ResourceProperties
{
public const string Host = "Host";
public const string Port = "Port";
+ public const string Transport = "Transport";
public const string UseTls = "UseTls";
public const string ServerName = "ServerName";
+ public const string WebSocketPath = "WebSocketPath";
public const string Strategy = "Strategy";
public const string InitialDelay = "InitialDelay";
public const string Increment = "Increment";
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionConfigurationConverter.cs b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionConfigurationConverter.cs
index a2f659f4..77e5029e 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionConfigurationConverter.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionConfigurationConverter.cs
@@ -229,7 +229,9 @@ private static JsonSerializerOptions CreateSerializerOptions()
{
PropertyNameCaseInsensitive = false
};
- options.Converters.Add(new JsonStringEnumConverter());
+ options.Converters.Add(new JsonStringEnumConverter(
+ namingPolicy: null,
+ allowIntegerValues: false));
return options;
}
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionResourceRegistrar.cs b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionResourceRegistrar.cs
index 9594074b..21257683 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionResourceRegistrar.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/MqttCompositionResourceRegistrar.cs
@@ -61,8 +61,10 @@ private static void RegisterBroker(IServiceCollection services, MqttIndexedResou
resource,
"Host",
"Port",
+ "Transport",
"UseTls",
- "ServerName");
+ "ServerName",
+ "WebSocketPath");
var configuration = MqttCompositionConfigurationConverter.Deserialize(
resource.Definition.Properties);
if (!HasKeyedService(services, resource.Address.Value))
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/README.md b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/README.md
index 3419e2ca..57dc7e46 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.Composition/README.md
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.Composition/README.md
@@ -21,6 +21,21 @@ Definitions use the exact canonical names above. Retired `resilience.retry`,
`mqtt.control`, and `mqtt.trigger` values are rejected and must be migrated
before load.
+### Broker transport
+
+Broker resources use one portable transport choice plus the existing TLS flag:
+
+| `Transport` | `UseTls` | Connection |
+| --- | --- | --- |
+| omitted or `Tcp` | `false` | TCP |
+| omitted or `Tcp` | `true` | TLS over TCP |
+| `WebSocket` | `false` | `ws` |
+| `WebSocket` | `true` | `wss` |
+
+WebSocket resources may set `WebSocketPath`; it defaults to `/mqtt`. The same
+properties are available through `MqttBrokerResourceBuilder`. They remain
+provider-neutral and work with both official adapters.
+
The host registers an `IMqttTransportFactory`, credentials, certificates, and
optional clocks. The four code-first resource contracts carry one shared MQTT
registrar into the built definition. `AddMqtt()` registers that exact registrar,
@@ -154,8 +169,10 @@ messaging
options =>
{
options.Host = "broker.internal";
- options.Port = 8883;
+ options.Port = 443;
+ options.Transport = MqttBrokerTransport.WebSocket;
options.UseTls = true;
+ options.WebSocketPath = "/mqtt";
},
out var broker)
.AddMqttSubscription(
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/FluxFlow.Components.Mqtt.MqttNet.csproj b/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/FluxFlow.Components.Mqtt.MqttNet.csproj
index 0620fa12..bb0a4f74 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/FluxFlow.Components.Mqtt.MqttNet.csproj
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/FluxFlow.Components.Mqtt.MqttNet.csproj
@@ -4,10 +4,10 @@
FluxFlow.Components.Mqtt.MqttNet
FluxFlow.Components.Mqtt.MqttNet
FluxFlow.Components.Mqtt.MqttNet
- 3.0.0
+ 3.1.0
Concrete MQTT transport adapter for FluxFlow. Maps resolved client configuration, exact message bytes, subscriptions, and broker acknowledgements while the provider-neutral MQTT core owns client policy and workflow behavior.
workflow;dataflow;components;mqtt;mqttnet
- Updates the transport adapter for the typed MQTT and FlowContent contracts while preserving protocol mapping and session behavior.
+ Maps the neutral FluxFlow broker configuration to TCP, TLS, WebSocket, and secure WebSocket MQTTnet channels.
README.md
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/MqttNetTransportSession.cs b/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/MqttNetTransportSession.cs
index 9ac03640..a756ea42 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/MqttNetTransportSession.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/MqttNetTransportSession.cs
@@ -367,11 +367,33 @@ private async Task WriteEventAsync(MqttTransportEvent transportEvent)
}
}
- private MqttClientOptions BuildClientOptions()
+ internal MqttClientOptions BuildClientOptions()
{
var builder = _builders
- .CreateClientOptionsBuilder()
- .WithTcpServer(_configuration.Broker.Host, _configuration.Broker.Port)
+ .CreateClientOptionsBuilder();
+
+ switch (_configuration.Broker.Transport)
+ {
+ case MqttBrokerTransport.WebSocket:
+ var endpoint = new UriBuilder(
+ _configuration.Broker.UseTls ? Uri.UriSchemeWss : Uri.UriSchemeWs,
+ _configuration.Broker.Host,
+ _configuration.Broker.Port,
+ _configuration.Broker.WebSocketPath).Uri;
+ builder.WithWebSocketServer(webSocket => webSocket
+ .WithUri(endpoint.AbsoluteUri)
+ .WithSubProtocols(["mqtt"]));
+ break;
+ case MqttBrokerTransport.Tcp:
+ builder.WithTcpServer(
+ _configuration.Broker.Host,
+ _configuration.Broker.Port);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(_configuration.Broker.Transport));
+ }
+
+ builder
.WithClientId(_configuration.ClientId)
.WithCleanStart(_configuration.CleanStart)
.WithKeepAlivePeriod(_configuration.KeepAlive)
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/README.md b/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/README.md
index 198a1219..4dfa35d3 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/README.md
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.MqttNet/README.md
@@ -2,6 +2,11 @@
Concrete transport adapter for `FluxFlow.Components.Mqtt`.
+The adapter maps the neutral broker configuration to MQTTnet TCP, TLS,
+WebSocket, or secure WebSocket channel options. `WebSocketPath` defaults to
+`/mqtt`, and WebSocket connections request the standard `mqtt` subprotocol.
+No MQTTnet type enters portable JSON or the core authoring surface.
+
The package exposes `MqttNetTransportFactory`, which implements the neutral
`IMqttTransportFactory` boundary. The resulting transport session maps resolved
client configuration, exact `FlowContent` bytes, subscriptions, connection
@@ -55,6 +60,8 @@ controller.
- Provider failures are classified through `MqttTransportException` so the
core can construct stable normal results.
- The session does not implement reconnect policy or desired-state ownership.
+- Browser applications use WebSocket/WSS. Native client-certificate and other
+ host capability checks belong to the browser host, not this adapter.
Version 2 removes the previous convenience client, adapter-specific client
options, hosted lifecycle registration, publisher/trigger interfaces, and
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/FluxFlow.Components.Mqtt.PulseMqtt.csproj b/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/FluxFlow.Components.Mqtt.PulseMqtt.csproj
index 8ba978e8..8286882a 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/FluxFlow.Components.Mqtt.PulseMqtt.csproj
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/FluxFlow.Components.Mqtt.PulseMqtt.csproj
@@ -4,10 +4,10 @@
FluxFlow.Components.Mqtt.PulseMqtt
FluxFlow.Components.Mqtt.PulseMqtt
FluxFlow.Components.Mqtt.PulseMqtt
- 4.0.0
+ 4.1.0
Concrete MQTT transport adapter for FluxFlow. Maps resolved client configuration, exact message bytes, subscriptions, and broker acknowledgements while the provider-neutral MQTT core owns client policy and workflow behavior.
workflow;dataflow;components;mqtt;pulsemqtt
- Updates the transport adapter for the typed MQTT and FlowContent contracts while preserving protocol mapping and session behavior.
+ Uses Pulse MQTT 2.29.0 and maps the neutral FluxFlow broker configuration to TCP, TLS, WebSocket, and secure WebSocket raw transports.
README.md
@@ -18,6 +18,7 @@
+
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/PulseMqttTransportSession.cs b/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/PulseMqttTransportSession.cs
index 7d4d2e37..86fa95f1 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/PulseMqttTransportSession.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/PulseMqttTransportSession.cs
@@ -46,15 +46,9 @@ public PulseMqttTransportSession(
_certificates = transportFactory is null
? LoadCertificates(configuration.Certificates)
: [];
- _transportFactory = transportFactory ??
- new TcpTransportFactory(new TcpTransportOptions
- {
- Host = configuration.Broker.Host,
- Port = configuration.Broker.Port,
- UseTls = configuration.Broker.UseTls,
- TlsTargetHost = configuration.Broker.ServerName ?? configuration.Broker.Host,
- ClientCertificates = _certificates.Count == 0 ? null : _certificates
- });
+ _transportFactory = transportFactory ?? CreateTransportFactory(
+ configuration.Broker,
+ _certificates);
}
public MqttTransportCapabilities Capabilities { get; } = new()
@@ -71,6 +65,51 @@ public PulseMqttTransportSession(
public IAsyncEnumerable Events =>
_events.Reader.ReadAllAsync();
+ internal static ProviderTransportFactory CreateTransportFactory(
+ MqttBrokerConfiguration broker,
+ X509Certificate2Collection certificates)
+ {
+ ArgumentNullException.ThrowIfNull(broker);
+ ArgumentNullException.ThrowIfNull(certificates);
+
+ return broker.Transport switch
+ {
+ MqttBrokerTransport.Tcp => new TcpTransportFactory(
+ CreateTcpOptions(broker, certificates)),
+ MqttBrokerTransport.WebSocket => new WebSocketTransportFactory(
+ CreateWebSocketOptions(broker, certificates)),
+ _ => throw new ArgumentOutOfRangeException(nameof(broker.Transport))
+ };
+ }
+
+ internal static TcpTransportOptions CreateTcpOptions(
+ MqttBrokerConfiguration broker,
+ X509Certificate2Collection certificates)
+ => new()
+ {
+ Host = broker.Host,
+ Port = broker.Port,
+ UseTls = broker.UseTls,
+ TlsTargetHost = broker.ServerName ?? broker.Host,
+ ClientCertificates = certificates.Count == 0 ? null : certificates
+ };
+
+ internal static WebSocketTransportOptions CreateWebSocketOptions(
+ MqttBrokerConfiguration broker,
+ X509Certificate2Collection certificates)
+ => new()
+ {
+ Uri = new UriBuilder(
+ broker.UseTls ? Uri.UriSchemeWss : Uri.UriSchemeWs,
+ broker.Host,
+ broker.Port,
+ broker.WebSocketPath).Uri,
+ SubProtocol = "mqtt",
+ ConfigureClient = certificates.Count == 0
+ ? null
+ : options => options.ClientCertificates.AddRange(certificates)
+ };
+
public async ValueTask ConnectAsync(CancellationToken cancellationToken = default)
{
ThrowIfDisposed();
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/README.md b/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/README.md
index f80326b4..eab8a4a6 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/README.md
+++ b/src/Mqtt/FluxFlow.Components.Mqtt.PulseMqtt/README.md
@@ -2,6 +2,22 @@
Concrete transport adapter for `FluxFlow.Components.Mqtt`.
+The current tested provider baseline is Pulse MQTT `2.29.0`.
+
+The adapter maps the neutral broker transport directly:
+
+| FluxFlow broker configuration | Pulse transport |
+| --- | --- |
+| `Tcp`, `UseTls = false` | `TcpTransportFactory` |
+| `Tcp`, `UseTls = true` | TLS `TcpTransportFactory` |
+| `WebSocket`, `UseTls = false` | `WebSocketTransportFactory` with `ws` |
+| `WebSocket`, `UseTls = true` | `WebSocketTransportFactory` with `wss` |
+
+WebSocket connections use `WebSocketPath` and the standard `mqtt`
+subprotocol. FluxFlow still creates Pulse's `RawMqttClient`; Pulse's resilient
+or hosted client is not used, so reconnect and subscription ownership stay in
+`MqttClientController`.
+
The package exposes `PulseMqttTransportFactory`, which implements the neutral
`IMqttTransportFactory` boundary. The resulting transport session maps resolved
client configuration, exact `FlowContent` bytes, subscriptions, connection
@@ -57,6 +73,8 @@ the unkeyed host default.
core can construct stable normal results.
- The session does not implement reconnect policy, durable workflow mailboxes,
or desired-state ownership.
+- Browser applications use WebSocket/WSS. Native client-certificate and other
+ host capability checks belong to the browser host, not this adapter.
Version 3 removes the previous convenience client, adapter-specific client and
store options, hosted lifecycle registration, publisher/trigger interfaces,
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt/Client/MqttClientConfigurationValidator.cs b/src/Mqtt/FluxFlow.Components.Mqtt/Client/MqttClientConfigurationValidator.cs
index 70628cfd..d09158f4 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt/Client/MqttClientConfigurationValidator.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt/Client/MqttClientConfigurationValidator.cs
@@ -21,6 +21,21 @@ internal static MqttClientConfiguration Validate(MqttClientConfiguration configu
nameof(configuration.Broker.Host));
if (configuration.Broker.Port is <= 0 or > 65535)
throw new ArgumentOutOfRangeException(nameof(configuration.Broker.Port));
+ if (!Enum.IsDefined(configuration.Broker.Transport))
+ throw new ArgumentOutOfRangeException(nameof(configuration.Broker.Transport));
+ if (configuration.Broker.Transport == MqttBrokerTransport.WebSocket)
+ {
+ ValidateWebSocketBroker(configuration.Broker);
+ }
+ else if (!string.Equals(
+ configuration.Broker.WebSocketPath,
+ "/mqtt",
+ StringComparison.Ordinal))
+ {
+ throw new ArgumentException(
+ "MQTT WebSocketPath can only be customized for WebSocket transport.",
+ nameof(configuration.Broker.WebSocketPath));
+ }
if (configuration.KeepAlive <= TimeSpan.Zero ||
configuration.KeepAlive > TimeSpan.FromSeconds(ushort.MaxValue))
throw new ArgumentOutOfRangeException(nameof(configuration.KeepAlive));
@@ -52,6 +67,26 @@ internal static MqttClientConfiguration Validate(MqttClientConfiguration configu
return configuration;
}
+ private static void ValidateWebSocketBroker(MqttBrokerConfiguration broker)
+ {
+ if (string.IsNullOrWhiteSpace(broker.WebSocketPath) ||
+ broker.WebSocketPath[0] != '/' ||
+ broker.WebSocketPath.Contains('?') ||
+ broker.WebSocketPath.Contains('#'))
+ {
+ throw new ArgumentException(
+ "MQTT WebSocketPath must be an absolute path without a query or fragment.",
+ nameof(broker.WebSocketPath));
+ }
+
+ if (!string.IsNullOrWhiteSpace(broker.ServerName))
+ {
+ throw new NotSupportedException(
+ "MQTT ServerName overrides are not portable for WebSocket transport. " +
+ "Use the broker Host as the WSS server name.");
+ }
+ }
+
internal static void ValidateTriggerOptions(
MqttTriggerRegistrationOptions options,
Func resolveDefinition,
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt/Configuration/MqttBrokerConfiguration.cs b/src/Mqtt/FluxFlow.Components.Mqtt/Configuration/MqttBrokerConfiguration.cs
index e6acd019..d6478dee 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt/Configuration/MqttBrokerConfiguration.cs
+++ b/src/Mqtt/FluxFlow.Components.Mqtt/Configuration/MqttBrokerConfiguration.cs
@@ -6,7 +6,11 @@ public sealed record MqttBrokerConfiguration
public int Port { get; init; } = 1883;
+ public MqttBrokerTransport Transport { get; init; } = MqttBrokerTransport.Tcp;
+
public bool UseTls { get; init; }
public string? ServerName { get; init; }
+
+ public string WebSocketPath { get; init; } = "/mqtt";
}
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt/Configuration/MqttBrokerTransport.cs b/src/Mqtt/FluxFlow.Components.Mqtt/Configuration/MqttBrokerTransport.cs
new file mode 100644
index 00000000..f6b5421e
--- /dev/null
+++ b/src/Mqtt/FluxFlow.Components.Mqtt/Configuration/MqttBrokerTransport.cs
@@ -0,0 +1,7 @@
+namespace FluxFlow.Components.Mqtt.Configuration;
+
+public enum MqttBrokerTransport
+{
+ Tcp,
+ WebSocket
+}
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt/FluxFlow.Components.Mqtt.csproj b/src/Mqtt/FluxFlow.Components.Mqtt/FluxFlow.Components.Mqtt.csproj
index 2b8e8420..0f7116c4 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt/FluxFlow.Components.Mqtt.csproj
+++ b/src/Mqtt/FluxFlow.Components.Mqtt/FluxFlow.Components.Mqtt.csproj
@@ -4,10 +4,10 @@
FluxFlow.Components.Mqtt
FluxFlow.Components.Mqtt
FluxFlow.Components.Mqtt
- 7.0.0
+ 7.1.0
Transport-neutral MQTT client orchestration and standalone FluxFlow components for commands, publish, receive, workflow acknowledgement, and client events. No engine or concrete MQTT client required.
workflow;dataflow;components;mqtt
- Migrates MQTT control and publish operations to typed command/result messages with in-band FlowError values while preserving transport and lifecycle semantics.
+ Adds provider-neutral TCP, TLS, WebSocket, and secure WebSocket broker selection while preserving existing TCP defaults and lifecycle ownership.
README.md
diff --git a/src/Mqtt/FluxFlow.Components.Mqtt/README.md b/src/Mqtt/FluxFlow.Components.Mqtt/README.md
index b70cdb13..41cec0a9 100644
--- a/src/Mqtt/FluxFlow.Components.Mqtt/README.md
+++ b/src/Mqtt/FluxFlow.Components.Mqtt/README.md
@@ -31,6 +31,38 @@ Credentials and certificates supplied to the core configuration are already
resolved host values. Secret lookup and inline-secret policy remain host
responsibilities.
+## Portable broker transports
+
+`Transport` selects the wire transport and `UseTls` selects whether that
+transport is secured. Existing definitions omit `Transport` and continue to
+use TCP.
+
+| `Transport` | `UseTls` | Connection |
+| --- | --- | --- |
+| `Tcp` | `false` | TCP |
+| `Tcp` | `true` | TLS over TCP |
+| `WebSocket` | `false` | `ws` |
+| `WebSocket` | `true` | `wss` |
+
+For WebSocket connections, `WebSocketPath` defaults to `/mqtt`:
+
+```csharp
+var broker = new MqttBrokerConfiguration
+{
+ Host = "broker.example.net",
+ Port = 443,
+ Transport = MqttBrokerTransport.WebSocket,
+ UseTls = true,
+ WebSocketPath = "/mqtt"
+};
+```
+
+`ServerName` is a TCP/TLS target-host override. WebSocket connections use
+`Host` for WSS certificate and server-name validation, so an independent
+`ServerName` is rejected. Browser hosts should expose WebSocket/WSS and reject
+native-only settings such as client-certificate loading in their own
+capability validation; the neutral MQTT core does not detect host platforms.
+
## Components
| Class | Canonical type | Ports | Purpose |
diff --git a/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttApplicationDefinitionAuthoringTests.cs b/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttApplicationDefinitionAuthoringTests.cs
index 1d629ea4..1af42d10 100644
--- a/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttApplicationDefinitionAuthoringTests.cs
+++ b/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttApplicationDefinitionAuthoringTests.cs
@@ -265,6 +265,59 @@ public void Typed_mqtt_authoring_projects_resources_components_options_and_ports
ApplicationDefinitionJson.Serialize(roundTripped).ShouldBe(json);
}
+ [Theory]
+ [InlineData(MqttBrokerTransport.Tcp, false, "/mqtt")]
+ [InlineData(MqttBrokerTransport.Tcp, true, "/mqtt")]
+ [InlineData(MqttBrokerTransport.WebSocket, false, "/tenant/mqtt")]
+ [InlineData(MqttBrokerTransport.WebSocket, true, "/tenant/mqtt")]
+ public async Task Typed_broker_transport_matrix_projects_and_resolves_exact_portable_configuration(
+ MqttBrokerTransport transport,
+ bool useTls,
+ string webSocketPath)
+ {
+ var builder = new ApplicationDefinitionBuilder();
+ var broker = builder.AddMqttBroker("Broker", mqtt =>
+ {
+ mqtt.Host = "broker.internal";
+ mqtt.Port = 9443;
+ mqtt.Transport = transport;
+ mqtt.UseTls = useTls;
+ mqtt.WebSocketPath = webSocketPath;
+ });
+ var client = builder.AddMqttClient("Client", mqtt =>
+ {
+ mqtt.ClientId = "portable-client";
+ mqtt.Broker = broker;
+ mqtt.AutoConnect = MqttAutoConnectMode.Disabled;
+ });
+
+ var definition = builder.Build();
+ var brokerDefinition = definition.Resources["Broker"]
+ .ShouldBeOfType();
+ brokerDefinition.Type.ShouldBe("mqtt.broker");
+ brokerDefinition.Properties.Keys.ShouldBe(
+ ["Host", "Port", "Transport", "UseTls", "WebSocketPath"],
+ ignoreOrder: true);
+ brokerDefinition.Properties["Host"].GetString().ShouldBe("broker.internal");
+ brokerDefinition.Properties["Port"].GetInt32().ShouldBe(9443);
+ brokerDefinition.Properties["Transport"].GetString().ShouldBe(transport.ToString());
+ brokerDefinition.Properties["UseTls"].GetBoolean().ShouldBe(useTls);
+ brokerDefinition.Properties["WebSocketPath"].GetString().ShouldBe(webSocketPath);
+
+ await using var hostProvider = new ServiceCollection().BuildServiceProvider();
+ var services = new ServiceCollection();
+ MqttCompositionResourceRegistrar.Register(services, definition, hostProvider);
+ await using var provider = services.BuildServiceProvider();
+ var configuration = provider.GetRequiredKeyedService(
+ client.Address.Value);
+
+ configuration.Broker.Host.ShouldBe("broker.internal");
+ configuration.Broker.Port.ShouldBe(9443);
+ configuration.Broker.Transport.ShouldBe(transport);
+ configuration.Broker.UseTls.ShouldBe(useTls);
+ configuration.Broker.WebSocketPath.ShouldBe(webSocketPath);
+ }
+
[Fact]
public async Task Typed_mqtt_definition_remains_compatible_with_resource_registration()
{
@@ -306,7 +359,9 @@ public async Task Typed_mqtt_definition_remains_compatible_with_resource_registr
configuration.ClientId.ShouldBe("typed-client");
configuration.Broker.Host.ShouldBe("broker.internal");
configuration.Broker.Port.ShouldBe(8883);
+ configuration.Broker.Transport.ShouldBe(MqttBrokerTransport.Tcp);
configuration.Broker.UseTls.ShouldBeTrue();
+ configuration.Broker.WebSocketPath.ShouldBe("/mqtt");
configuration.Credentials.ShouldNotBeNull().Username.ShouldBe("host-user");
configuration.Subscriptions.Keys.ShouldBe(["Commands"], ignoreOrder: false);
configuration.Subscriptions["Commands"].TopicFilter.ShouldBe("commands/#");
diff --git a/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttServiceCollectionExtensionsTests.cs b/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttServiceCollectionExtensionsTests.cs
index 8d6a68e6..df7b9936 100644
--- a/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttServiceCollectionExtensionsTests.cs
+++ b/tests/FluxFlow.Components.Mqtt.Composition.Tests/MqttServiceCollectionExtensionsTests.cs
@@ -179,6 +179,106 @@ public async Task Canonical_resources_bind_nested_addresses_shared_broker_and_sc
.ShouldNotBeSameAs(firstController);
}
+ [Theory]
+ [InlineData("Tcp", false, "/mqtt")]
+ [InlineData("Tcp", true, "/mqtt")]
+ [InlineData("WebSocket", false, "/tenant/mqtt")]
+ [InlineData("WebSocket", true, "/tenant/mqtt")]
+ public async Task Portable_json_broker_transport_matrix_resolves_exact_configuration(
+ string transport,
+ bool useTls,
+ string webSocketPath)
+ {
+ var definition = Parse($$"""
+ {
+ "Resources": {
+ "Broker": {
+ "Type": "mqtt.broker",
+ "Host": "broker.internal",
+ "Port": 9443,
+ "Transport": "{{transport}}",
+ "UseTls": {{useTls.ToString().ToLowerInvariant()}},
+ "WebSocketPath": "{{webSocketPath}}"
+ },
+ "Client": {
+ "Type": "mqtt.client",
+ "ClientId": "portable-client",
+ "Broker": "Resources.Broker",
+ "AutoConnect": "Disabled"
+ }
+ },
+ "Workflows": {}
+ }
+ """);
+ await using var hostProvider = new ServiceCollection().BuildServiceProvider();
+ var services = new ServiceCollection();
+ RegisterResources(services, definition, hostProvider);
+ await using var provider = services.BuildServiceProvider();
+
+ var broker = provider
+ .GetRequiredKeyedService("Resources.Client")
+ .Broker;
+
+ broker.Host.ShouldBe("broker.internal");
+ broker.Port.ShouldBe(9443);
+ broker.Transport.ToString().ShouldBe(transport);
+ broker.UseTls.ShouldBe(useTls);
+ broker.WebSocketPath.ShouldBe(webSocketPath);
+ }
+
+ [Theory]
+ [InlineData("\"WebSockets\"")]
+ [InlineData("1")]
+ [InlineData("99")]
+ public async Task Portable_json_rejects_invalid_or_non_string_transport_values(
+ string rawTransport)
+ {
+ var definition = Parse($$"""
+ {
+ "Resources": {
+ "Broker": {
+ "Type": "mqtt.broker",
+ "Host": "broker.internal",
+ "Transport": {{rawTransport}}
+ }
+ },
+ "Workflows": {}
+ }
+ """);
+ await using var hostProvider = new ServiceCollection().BuildServiceProvider();
+
+ var error = Should.Throw(() =>
+ RegisterResources(new ServiceCollection(), definition, hostProvider));
+
+ error.Message.ShouldContain("MqttBrokerTransport", Case.Sensitive);
+ error.Path.ShouldBe("$.Transport");
+ }
+
+ [Fact]
+ public async Task Portable_json_rejects_provider_specific_broker_transport_properties()
+ {
+ var definition = Parse("""
+ {
+ "Resources": {
+ "Broker": {
+ "Type": "mqtt.broker",
+ "Host": "broker.internal",
+ "WebSocketOptions": { "SubProtocol": "mqtt" }
+ }
+ },
+ "Workflows": {}
+ }
+ """);
+ await using var hostProvider = new ServiceCollection().BuildServiceProvider();
+
+ var error = Should.Throw(() =>
+ RegisterResources(new ServiceCollection(), definition, hostProvider));
+
+ error.Message.ShouldContain("Resources.Broker", Case.Sensitive);
+ error.Message.ShouldContain("WebSocketOptions", Case.Sensitive);
+ error.Message.ShouldContain("unsupported", Case.Insensitive);
+ }
+
[Fact]
public async Task Revision_provider_owns_container_created_controller_not_host_provider()
{
diff --git a/tests/FluxFlow.Components.Mqtt.MqttNet.Tests/MqttNetTransportSessionTests.cs b/tests/FluxFlow.Components.Mqtt.MqttNet.Tests/MqttNetTransportSessionTests.cs
index bd40ac8f..89a2d563 100644
--- a/tests/FluxFlow.Components.Mqtt.MqttNet.Tests/MqttNetTransportSessionTests.cs
+++ b/tests/FluxFlow.Components.Mqtt.MqttNet.Tests/MqttNetTransportSessionTests.cs
@@ -8,12 +8,106 @@
using MQTTnet.Protocol;
using Shouldly;
using System.Net;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
using Xunit;
namespace FluxFlow.Components.Mqtt.MqttNet.Tests;
public sealed class MqttNetTransportSessionTests
{
+ [Theory]
+ [InlineData(MqttBrokerTransport.Tcp, false, "tcp")]
+ [InlineData(MqttBrokerTransport.Tcp, true, "tls")]
+ [InlineData(MqttBrokerTransport.WebSocket, false, "ws")]
+ [InlineData(MqttBrokerTransport.WebSocket, true, "wss")]
+ public async Task Session_maps_all_four_portable_modes_to_exact_mqttnet_channel_options(
+ MqttBrokerTransport transport,
+ bool useTls,
+ string expectedScheme)
+ {
+ using var certificate = CreateCertificate();
+ var broker = new MqttBrokerConfiguration
+ {
+ Host = transport == MqttBrokerTransport.WebSocket
+ ? "2001:db8::1"
+ : "broker.internal",
+ Port = 9443,
+ Transport = transport,
+ UseTls = useTls,
+ ServerName = transport == MqttBrokerTransport.Tcp
+ ? "sni.internal"
+ : null,
+ WebSocketPath = transport == MqttBrokerTransport.WebSocket
+ ? "/tenant mqtt"
+ : "/mqtt"
+ };
+ var configuration = Configuration(broker) with
+ {
+ Certificates =
+ [
+ new MqttClientCertificate
+ {
+ Name = "client.cer",
+ Content = certificate.Export(X509ContentType.Cert)
+ }
+ ]
+ };
+ var provider = new VNextRecordingMqttNetClient();
+ await using var session = new MqttNetTransportSession(
+ configuration,
+ new MqttClientFactory(),
+ provider,
+ TimeProvider.System);
+
+ var options = session.BuildClientOptions();
+
+ MqttClientTlsOptions? tls;
+ if (transport == MqttBrokerTransport.Tcp)
+ {
+ var tcp = options.ChannelOptions.ShouldBeOfType();
+ var endpoint = tcp.RemoteEndpoint.ShouldBeOfType();
+ endpoint.Host.ShouldBe("broker.internal");
+ endpoint.Port.ShouldBe(9443);
+ tls = tcp.TlsOptions;
+ }
+ else
+ {
+ var webSocket = options.ChannelOptions
+ .ShouldBeOfType();
+ var endpoint = new Uri(webSocket.Uri, UriKind.Absolute);
+ endpoint.AbsoluteUri.ShouldBe(
+ $"{expectedScheme}://[2001:db8::1]:9443/tenant%20mqtt");
+ webSocket.SubProtocols.ShouldBe(["mqtt"], ignoreOrder: false);
+ tls = webSocket.TlsOptions;
+ }
+
+ if (useTls)
+ {
+ var secureTls = tls.ShouldNotBeNull();
+ secureTls.UseTls.ShouldBeTrue();
+ secureTls.TargetHost.ShouldBe(
+ transport == MqttBrokerTransport.Tcp
+ ? "sni.internal"
+ : "2001:db8::1");
+ secureTls.ClientCertificatesProvider.ShouldNotBeNull()
+ .GetCertificates()
+ .Cast()
+ .ShouldHaveSingleItem()
+ .Thumbprint.ShouldBe(certificate.Thumbprint);
+ }
+ else if (transport == MqttBrokerTransport.WebSocket)
+ {
+ tls.ShouldBeNull();
+ }
+ else
+ {
+ var plainTls = tls.ShouldNotBeNull();
+ plainTls.UseTls.ShouldBeFalse();
+ plainTls.ClientCertificatesProvider.ShouldBeNull();
+ }
+ }
+
[Fact]
public async Task SessionMapsConfigurationPublishAndSubscriptionsWithoutOwningPolicy()
{
@@ -126,12 +220,13 @@ public async Task ConnectRejectionPreservesAuthenticationClassification()
session.IsConnected.ShouldBeFalse();
}
- private static MqttClientConfiguration Configuration()
+ private static MqttClientConfiguration Configuration(
+ MqttBrokerConfiguration? broker = null)
=> new()
{
Name = "client-1",
ClientId = "client-1",
- Broker = new MqttBrokerConfiguration
+ Broker = broker ?? new MqttBrokerConfiguration
{
Host = "broker.internal",
Port = 1884
@@ -147,4 +242,17 @@ private static async Task ReadNextAsync(IAsyncEnumerable source)
return value;
throw new InvalidOperationException("The MQTT transport stream completed without a value.");
}
+
+ private static X509Certificate2 CreateCertificate()
+ {
+ using var key = RSA.Create(2048);
+ var request = new CertificateRequest(
+ "CN=FluxFlow MQTT transport test",
+ key,
+ HashAlgorithmName.SHA256,
+ RSASignaturePadding.Pkcs1);
+ return request.CreateSelfSigned(
+ DateTimeOffset.UtcNow.AddDays(-1),
+ DateTimeOffset.UtcNow.AddDays(1));
+ }
}
diff --git a/tests/FluxFlow.Components.Mqtt.PulseMqtt.Tests/PulseMqttTransportSessionTests.cs b/tests/FluxFlow.Components.Mqtt.PulseMqtt.Tests/PulseMqttTransportSessionTests.cs
index 01947fb5..d13a32f3 100644
--- a/tests/FluxFlow.Components.Mqtt.PulseMqtt.Tests/PulseMqttTransportSessionTests.cs
+++ b/tests/FluxFlow.Components.Mqtt.PulseMqtt.Tests/PulseMqttTransportSessionTests.cs
@@ -4,14 +4,76 @@
using FluxFlow.Components.Mqtt.Subscriptions;
using FluxFlow.Components.Mqtt.Transport;
using FluxFlow.Data;
+using Pulse.Mqtt.Transport;
using Pulse.Mqtt.Testing;
using Shouldly;
+using System.Net.WebSockets;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
using Xunit;
namespace FluxFlow.Components.Mqtt.PulseMqtt.Tests;
public sealed class PulseMqttTransportSessionTests
{
+ [Theory]
+ [InlineData(MqttBrokerTransport.Tcp, false, "tcp")]
+ [InlineData(MqttBrokerTransport.Tcp, true, "tls")]
+ [InlineData(MqttBrokerTransport.WebSocket, false, "ws")]
+ [InlineData(MqttBrokerTransport.WebSocket, true, "wss")]
+ public void Session_maps_all_four_portable_modes_to_exact_pulse_transport_options(
+ MqttBrokerTransport transport,
+ bool useTls,
+ string expectedScheme)
+ {
+ using var certificate = CreateCertificate();
+ var certificates = new X509Certificate2Collection(certificate);
+ var broker = new MqttBrokerConfiguration
+ {
+ Host = transport == MqttBrokerTransport.WebSocket
+ ? "2001:db8::1"
+ : "broker.internal",
+ Port = 9443,
+ Transport = transport,
+ UseTls = useTls,
+ ServerName = transport == MqttBrokerTransport.Tcp
+ ? "sni.internal"
+ : null,
+ WebSocketPath = transport == MqttBrokerTransport.WebSocket
+ ? "/tenant mqtt"
+ : "/mqtt"
+ };
+
+ var factory = PulseMqttTransportSession.CreateTransportFactory(broker, certificates);
+
+ if (transport == MqttBrokerTransport.Tcp)
+ {
+ factory.ShouldBeOfType();
+ var options = PulseMqttTransportSession.CreateTcpOptions(broker, certificates);
+ options.Host.ShouldBe("broker.internal");
+ options.Port.ShouldBe(9443);
+ options.UseTls.ShouldBe(useTls);
+ options.TlsTargetHost.ShouldBe("sni.internal");
+ options.ClientCertificates.ShouldBeSameAs(certificates);
+ return;
+ }
+
+ factory.ShouldBeOfType();
+ var webSocket = PulseMqttTransportSession.CreateWebSocketOptions(
+ broker,
+ certificates);
+ webSocket.Uri.Scheme.ShouldBe(expectedScheme);
+ webSocket.Uri.AbsoluteUri.ShouldBe(
+ $"{expectedScheme}://[2001:db8::1]:9443/tenant%20mqtt");
+ webSocket.SubProtocol.ShouldBe("mqtt");
+ var configure = webSocket.ConfigureClient.ShouldNotBeNull();
+ using var client = new ClientWebSocket();
+ configure(client.Options);
+ client.Options.ClientCertificates
+ .Cast()
+ .ShouldContain(certificate);
+ }
+
[Fact]
public async Task SessionMapsExactContentAndSupportsReconnectWithoutOwningPolicy()
{
@@ -92,4 +154,17 @@ private static async Task ReadNextAsync(
return value;
throw new InvalidOperationException("The MQTT transport stream completed without a value.");
}
+
+ private static X509Certificate2 CreateCertificate()
+ {
+ using var key = RSA.Create(2048);
+ var request = new CertificateRequest(
+ "CN=FluxFlow MQTT transport test",
+ key,
+ HashAlgorithmName.SHA256,
+ RSASignaturePadding.Pkcs1);
+ return request.CreateSelfSigned(
+ DateTimeOffset.UtcNow.AddDays(-1),
+ DateTimeOffset.UtcNow.AddDays(1));
+ }
}
diff --git a/tests/FluxFlow.Components.Mqtt.Tests/MqttBrokerConfigurationTests.cs b/tests/FluxFlow.Components.Mqtt.Tests/MqttBrokerConfigurationTests.cs
new file mode 100644
index 00000000..ddb3ad1a
--- /dev/null
+++ b/tests/FluxFlow.Components.Mqtt.Tests/MqttBrokerConfigurationTests.cs
@@ -0,0 +1,98 @@
+using FluxFlow.Components.Mqtt.Client;
+using FluxFlow.Components.Mqtt.Configuration;
+using FluxFlow.Components.Mqtt.Options;
+using Shouldly;
+using Xunit;
+
+namespace FluxFlow.Components.Mqtt.Tests;
+
+public sealed class MqttBrokerConfigurationTests
+{
+ [Fact]
+ public void Broker_transport_contract_is_provider_neutral_and_has_stable_defaults()
+ {
+ Enum.GetNames().ShouldBe(["Tcp", "WebSocket"]);
+ Enum.GetValues()
+ .Select(static value => (int)value)
+ .ShouldBe([0, 1]);
+
+ var broker = new MqttBrokerConfiguration { Host = "broker.internal" };
+
+ broker.Transport.ShouldBe(MqttBrokerTransport.Tcp);
+ broker.UseTls.ShouldBeFalse();
+ broker.WebSocketPath.ShouldBe("/mqtt");
+ broker.ServerName.ShouldBeNull();
+ }
+
+ [Theory]
+ [InlineData(MqttBrokerTransport.Tcp, false)]
+ [InlineData(MqttBrokerTransport.Tcp, true)]
+ [InlineData(MqttBrokerTransport.WebSocket, false)]
+ [InlineData(MqttBrokerTransport.WebSocket, true)]
+ public async Task Configuration_accepts_all_four_portable_transport_modes_without_host_capability_checks(
+ MqttBrokerTransport transport,
+ bool useTls)
+ {
+ var broker = new MqttBrokerConfiguration
+ {
+ Host = "broker.internal",
+ Port = 9443,
+ Transport = transport,
+ UseTls = useTls,
+ WebSocketPath = transport == MqttBrokerTransport.WebSocket
+ ? "/tenant/mqtt"
+ : "/mqtt"
+ };
+ var configuration = Configuration(broker);
+ var factory = new VNextRecordingMqttTransportFactory();
+ await using var controller = new MqttClientController(configuration, factory);
+
+ await controller.StartAsync();
+
+ factory.Configurations.ShouldHaveSingleItem().ShouldBeSameAs(configuration);
+ factory.Sessions.ShouldHaveSingleItem();
+ }
+
+ [Theory]
+ [InlineData(99, "/mqtt", null, typeof(ArgumentOutOfRangeException))]
+ [InlineData(1, null, null, typeof(ArgumentException))]
+ [InlineData(1, "", null, typeof(ArgumentException))]
+ [InlineData(1, " ", null, typeof(ArgumentException))]
+ [InlineData(1, "mqtt", null, typeof(ArgumentException))]
+ [InlineData(1, "/mqtt?token=value", null, typeof(ArgumentException))]
+ [InlineData(1, "/mqtt#fragment", null, typeof(ArgumentException))]
+ [InlineData(1, "/mqtt", "sni.internal", typeof(NotSupportedException))]
+ [InlineData(0, "/custom", null, typeof(ArgumentException))]
+ public void Configuration_rejects_invalid_transport_path_and_websocket_server_name_before_transport_creation(
+ int transport,
+ string? webSocketPath,
+ string? serverName,
+ Type expectedException)
+ {
+ var factory = new VNextRecordingMqttTransportFactory();
+ var configuration = Configuration(new MqttBrokerConfiguration
+ {
+ Host = "broker.internal",
+ Transport = (MqttBrokerTransport)transport,
+ WebSocketPath = webSocketPath!,
+ ServerName = serverName
+ });
+
+ var exception = Record.Exception(() =>
+ new MqttClientController(configuration, factory));
+
+ exception.ShouldNotBeNull().GetType().ShouldBe(expectedException);
+ factory.Configurations.ShouldBeEmpty();
+ factory.Sessions.ShouldBeEmpty();
+ }
+
+ private static MqttClientConfiguration Configuration(MqttBrokerConfiguration broker)
+ => new()
+ {
+ Name = "client-1",
+ ClientId = "client-1",
+ Broker = broker,
+ AutoConnect = MqttAutoConnectMode.Disabled,
+ Reconnect = new MqttReconnectConfiguration { Enabled = false }
+ };
+}
diff --git a/tests/FluxFlow.Components.Mqtt.Tests/VNextRecordingMqttTransport.cs b/tests/FluxFlow.Components.Mqtt.Tests/VNextRecordingMqttTransport.cs
index be251451..2c098603 100644
--- a/tests/FluxFlow.Components.Mqtt.Tests/VNextRecordingMqttTransport.cs
+++ b/tests/FluxFlow.Components.Mqtt.Tests/VNextRecordingMqttTransport.cs
@@ -19,11 +19,14 @@ public VNextRecordingMqttTransportFactory(Func Sessions { get; } = new();
+ public ConcurrentQueue Configurations { get; } = new();
+
public ValueTask CreateAsync(
MqttClientConfiguration configuration,
CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
+ Configurations.Enqueue(configuration);
var session = _create();
Sessions.Enqueue(session);
return ValueTask.FromResult(session);
diff --git a/tests/FluxFlow.Engine.Tests/ApplicationDefinitionSourcesTests.cs b/tests/FluxFlow.Engine.Tests/ApplicationDefinitionSourcesTests.cs
index 4548bc9a..5ad163c9 100644
--- a/tests/FluxFlow.Engine.Tests/ApplicationDefinitionSourcesTests.cs
+++ b/tests/FluxFlow.Engine.Tests/ApplicationDefinitionSourcesTests.cs
@@ -1,4 +1,5 @@
using System.Text;
+using System.Text.Json;
using FluxFlow.Composition.Model;
using Microsoft.Extensions.Configuration;
using Shouldly;
@@ -8,6 +9,41 @@ namespace FluxFlow.Engine.Tests;
public sealed class ApplicationDefinitionSourcesTests
{
+ [Fact]
+ public async Task Configuration_source_preserves_boolean_resource_and_component_properties_through_definition_round_trip()
+ {
+ var configuration = new ConfigurationBuilder()
+ .AddInMemoryCollection(new Dictionary
+ {
+ ["Application:Resources:Flags:Type"] = "test.flags",
+ ["Application:Resources:Flags:ResourceEnabled"] = "True",
+ ["Application:Resources:Flags:ResourceDisabled"] = "False",
+ ["Application:Workflows:Main:Switch:Type"] = "switch",
+ ["Application:Workflows:Main:Switch:ComponentEnabled"] = "True",
+ ["Application:Workflows:Main:Switch:ComponentDisabled"] = "False"
+ })
+ .Build();
+
+ var definition = await new ConfigurationApplicationDefinitionSource(
+ configuration,
+ "Application")
+ .LoadAsync();
+
+ AssertBooleanProperties(definition);
+
+ var json = ApplicationDefinitionJson.Serialize(definition);
+ json.ShouldContain("\"ResourceEnabled\":true");
+ json.ShouldContain("\"ResourceDisabled\":false");
+ json.ShouldContain("\"ComponentEnabled\":true");
+ json.ShouldContain("\"ComponentDisabled\":false");
+ json.ShouldNotContain("\"ResourceEnabled\":\"True\"");
+ json.ShouldNotContain("\"ResourceDisabled\":\"False\"");
+ json.ShouldNotContain("\"ComponentEnabled\":\"True\"");
+ json.ShouldNotContain("\"ComponentDisabled\":\"False\"");
+
+ AssertBooleanProperties(ApplicationDefinitionJson.Deserialize(json));
+ }
+
[Fact]
public async Task Configuration_source_reconstructs_the_canonical_tree_in_engine()
{
@@ -41,4 +77,28 @@ public async Task Configuration_source_reconstructs_the_canonical_tree_in_engine
source.Type.ShouldBe("source");
source.Properties["Values"].GetArrayLength().ShouldBe(2);
}
+
+ private static void AssertBooleanProperties(ApplicationDefinition definition)
+ {
+ var resource = definition.Resources["Flags"]
+ .ShouldBeOfType();
+ resource.Type.ShouldBe("test.flags");
+ AssertBoolean(resource.Properties, "ResourceEnabled", expected: true);
+ AssertBoolean(resource.Properties, "ResourceDisabled", expected: false);
+
+ var component = definition.Workflows["Main"].Components["Switch"];
+ component.Type.ShouldBe("switch");
+ AssertBoolean(component.Properties, "ComponentEnabled", expected: true);
+ AssertBoolean(component.Properties, "ComponentDisabled", expected: false);
+ }
+
+ private static void AssertBoolean(
+ IReadOnlyDictionary properties,
+ string name,
+ bool expected)
+ {
+ var value = properties[name];
+ value.ValueKind.ShouldBe(expected ? JsonValueKind.True : JsonValueKind.False);
+ value.GetBoolean().ShouldBe(expected);
+ }
}
diff --git a/tests/FluxFlow.Release.Tests/MqttPortableTransportConventionTests.cs b/tests/FluxFlow.Release.Tests/MqttPortableTransportConventionTests.cs
new file mode 100644
index 00000000..f0d05bc5
--- /dev/null
+++ b/tests/FluxFlow.Release.Tests/MqttPortableTransportConventionTests.cs
@@ -0,0 +1,219 @@
+using System.Xml.Linq;
+using Shouldly;
+using Xunit;
+
+namespace FluxFlow.Release.Tests;
+
+public sealed class MqttPortableTransportConventionTests
+{
+ [Fact]
+ public void Portable_mqtt_transport_contract_has_no_provider_reflection_or_browser_policy()
+ {
+ var root = ReleaseTestPaths.FindRepositoryRoot();
+ var core = Path.Combine(root, "src", "Mqtt", "FluxFlow.Components.Mqtt");
+ var composition = Path.Combine(
+ root,
+ "src",
+ "Mqtt",
+ "FluxFlow.Components.Mqtt.Composition");
+ var enumSource = File.ReadAllText(Path.Combine(
+ core,
+ "Configuration",
+ "MqttBrokerTransport.cs"));
+ var brokerSource = File.ReadAllText(Path.Combine(
+ core,
+ "Configuration",
+ "MqttBrokerConfiguration.cs"));
+ var validationSource = File.ReadAllText(Path.Combine(
+ core,
+ "Client",
+ "MqttClientConfigurationValidator.cs"));
+ var authoringSource = File.ReadAllText(Path.Combine(
+ composition,
+ "Authoring",
+ "MqttResourceAuthoring.cs"));
+ var definitionSource = File.ReadAllText(Path.Combine(
+ composition,
+ "MqttComponentDefinition.cs"));
+ var registrarSource = File.ReadAllText(Path.Combine(
+ composition,
+ "MqttCompositionResourceRegistrar.cs"));
+
+ enumSource.ShouldContain("public enum MqttBrokerTransport");
+ CountOccurrences(enumSource, "Tcp").ShouldBe(1);
+ CountOccurrences(enumSource, "WebSocket").ShouldBe(1);
+ brokerSource.ShouldContain("public MqttBrokerTransport Transport { get; init; }");
+ brokerSource.ShouldContain("public bool UseTls { get; init; }");
+ brokerSource.ShouldContain("public string WebSocketPath { get; init; } = \"/mqtt\";");
+ authoringSource.ShouldContain("public MqttBrokerTransport? Transport { get; set; }");
+ authoringSource.ShouldContain("public string? WebSocketPath { get; set; }");
+ authoringSource.ShouldContain("transport.ToString()");
+ definitionSource.ShouldContain("public const string Transport = \"Transport\";");
+ definitionSource.ShouldContain(
+ "public const string WebSocketPath = \"WebSocketPath\";");
+ registrarSource.ShouldContain("\"Transport\",");
+ registrarSource.ShouldContain("\"WebSocketPath\"");
+ validationSource.ShouldContain("Enum.IsDefined(configuration.Broker.Transport)");
+ validationSource.ShouldContain("broker.WebSocketPath[0] != '/'");
+ validationSource.ShouldContain("broker.WebSocketPath.Contains('?')");
+ validationSource.ShouldContain("broker.WebSocketPath.Contains('#')");
+ validationSource.ShouldContain(
+ "MQTT WebSocketPath can only be customized for WebSocket transport.");
+ validationSource.ShouldContain("!string.IsNullOrWhiteSpace(broker.ServerName)");
+
+ var neutralSource = string.Join(
+ Environment.NewLine,
+ enumSource,
+ brokerSource,
+ validationSource,
+ authoringSource,
+ definitionSource,
+ registrarSource);
+ foreach (var forbidden in new[]
+ {
+ "MQTTnet",
+ "Pulse.Mqtt",
+ "System.Reflection",
+ "Assembly.Load",
+ "GetTypes(",
+ "OperatingSystem.IsBrowser",
+ "RuntimeInformation",
+ "BrowserWebSocket",
+ "#if BROWSER"
+ })
+ {
+ neutralSource.ShouldNotContain(forbidden);
+ }
+
+ var documentation = new[]
+ {
+ Path.Combine(core, "README.md"),
+ Path.Combine(composition, "README.md"),
+ Path.Combine(root, "docs", "21-component-type-names.md")
+ };
+ foreach (var path in documentation)
+ {
+ var content = File.ReadAllText(path);
+ content.ShouldContain("Tcp");
+ content.ShouldContain("WebSocket");
+ content.ShouldContain("UseTls");
+ content.ShouldContain("ws");
+ content.ShouldContain("wss");
+ content.ShouldContain("/mqtt");
+ }
+ var coreReadme = File.ReadAllText(Path.Combine(core, "README.md"));
+ coreReadme.ShouldContain("| `Tcp` | `false` | TCP |");
+ coreReadme.ShouldContain("| `Tcp` | `true` | TLS over TCP |");
+ coreReadme.ShouldContain("| `WebSocket` | `false` | `ws` |");
+ coreReadme.ShouldContain("| `WebSocket` | `true` | `wss` |");
+ coreReadme.ShouldContain("the neutral MQTT core does not detect host platforms");
+ var compositionReadme = File.ReadAllText(Path.Combine(composition, "README.md"));
+ compositionReadme.ShouldContain("| omitted or `Tcp` | `false` | TCP |");
+ compositionReadme.ShouldContain("| omitted or `Tcp` | `true` | TLS over TCP |");
+ compositionReadme.ShouldContain("| `WebSocket` | `false` | `ws` |");
+ compositionReadme.ShouldContain("| `WebSocket` | `true` | `wss` |");
+
+ var sampleDirectory = Path.Combine(
+ root,
+ "samples",
+ "FluxFlow.MqttCompositionSample");
+ var sampleProgram = File.ReadAllText(Path.Combine(sampleDirectory, "Program.cs"));
+ sampleProgram.ShouldContain(
+ "broker.Transport = MqttBrokerTransport.WebSocket;");
+ sampleProgram.ShouldContain("broker.UseTls = true;");
+ sampleProgram.ShouldContain("broker.WebSocketPath = \"/mqtt\";");
+ var sampleConfiguration = File.ReadAllText(Path.Combine(
+ sampleDirectory,
+ "appsettings.json"));
+ sampleConfiguration.ShouldContain("\"Transport\": \"WebSocket\"");
+ sampleConfiguration.ShouldContain("\"UseTls\": true");
+ sampleConfiguration.ShouldContain("\"WebSocketPath\": \"/mqtt\"");
+ File.ReadAllText(Path.Combine(sampleDirectory, "README.md"))
+ .ShouldContain("portable `WebSocket` + `UseTls` broker shape for WSS");
+ }
+
+ [Fact]
+ public void Pulse_websocket_transport_dependency_is_exact_adapter_local_and_uses_raw_client()
+ {
+ var root = ReleaseTestPaths.FindRepositoryRoot();
+ var mqttRoot = Path.Combine(root, "src", "Mqtt");
+ var centralPackages = XDocument.Load(Path.Combine(root, "Directory.Packages.props"));
+ var webSocketVersions = centralPackages
+ .Descendants("PackageVersion")
+ .Where(static element =>
+ (string?)element.Attribute("Include") == "Pulse.Mqtt.Transport.WebSocket")
+ .Select(static element => (string?)element.Attribute("Version"))
+ .ToArray();
+ webSocketVersions.ShouldBe(["2.29.0"]);
+
+ var projects = Directory.GetFiles(
+ mqttRoot,
+ "*.csproj",
+ SearchOption.AllDirectories);
+ var webSocketReferences = projects
+ .Where(path => XDocument.Load(path)
+ .Descendants("PackageReference")
+ .Any(static element =>
+ (string?)element.Attribute("Include") ==
+ "Pulse.Mqtt.Transport.WebSocket"))
+ .Select(path => Path.GetRelativePath(root, path))
+ .ToArray();
+ webSocketReferences.ShouldBe([
+ Path.Combine(
+ "src",
+ "Mqtt",
+ "FluxFlow.Components.Mqtt.PulseMqtt",
+ "FluxFlow.Components.Mqtt.PulseMqtt.csproj")
+ ]);
+
+ var expectedVersions = new Dictionary(StringComparer.Ordinal)
+ {
+ ["FluxFlow.Components.Mqtt"] = "7.1.0",
+ ["FluxFlow.Components.Mqtt.Composition"] = "7.1.0-rc.1",
+ ["FluxFlow.Components.Mqtt.MqttNet"] = "3.1.0",
+ ["FluxFlow.Components.Mqtt.PulseMqtt"] = "4.1.0"
+ };
+ foreach (var (projectName, expectedVersion) in expectedVersions)
+ {
+ var project = XDocument.Load(Path.Combine(
+ mqttRoot,
+ projectName,
+ $"{projectName}.csproj"));
+ project.Descendants("Version")
+ .Select(static element => element.Value)
+ .ShouldHaveSingleItem()
+ .ShouldBe(expectedVersion);
+ }
+
+ var pulseDirectory = Path.Combine(
+ mqttRoot,
+ "FluxFlow.Components.Mqtt.PulseMqtt");
+ var pulseSource = File.ReadAllText(Path.Combine(
+ pulseDirectory,
+ "PulseMqttTransportSession.cs"));
+ CountOccurrences(pulseSource, "new RawMqttClient(").ShouldBe(1);
+ pulseSource.ShouldContain("CreateTcpOptions(broker, certificates)");
+ pulseSource.ShouldContain("CreateWebSocketOptions(broker, certificates)");
+ pulseSource.ShouldContain("SubProtocol = \"mqtt\"");
+ pulseSource.ShouldNotContain("ResilientMqttClient");
+ pulseSource.ShouldNotContain("AddPulseMqttClient");
+ pulseSource.ShouldNotContain("MqttClientController");
+ pulseSource.ShouldNotContain("RetryPlanner");
+ pulseSource.ShouldNotContain("OperatingSystem.IsBrowser");
+
+ foreach (var adapterReadme in new[]
+ {
+ Path.Combine(pulseDirectory, "README.md"),
+ Path.Combine(mqttRoot, "FluxFlow.Components.Mqtt.MqttNet", "README.md")
+ })
+ {
+ var content = File.ReadAllText(adapterReadme);
+ content.ShouldContain("WebSocket");
+ content.ShouldContain("WSS", Case.Insensitive);
+ content.ShouldContain("host capability checks belong to the browser host");
+ }
+ }
+
+ private static int CountOccurrences(string source, string value)
+ => source.Split(value, StringSplitOptions.None).Length - 1;
+}