0001 — Transport type: single-device vs multi-device¶
A custom transport now serves exactly one device, and a transport that carries several devices at once
declares transport.type: multiplex. The address-keyed methods (Bind(address, router), Unbind(address),
Resolve(address), NotifyDisconnected(address)) on a single-device custom transport are [Obsolete]
compatibility shims: your adapter still builds and runs, but you get deprecation warnings until you follow
the steps below.
For the transport-type model these steps refer to, see Transport types.
Fix the warnings¶
Step 1 — Decide which transport you are¶
- One device per transport instance → single-device, keep
transport.type: custom, go to Step 2. - One connection/driver carrying several devices, each identified by an address in its events → multi-device, go to Step 3.
(See Transport types → choosing single vs multi.)
Step 2 — Single-device (custom): drop the address¶
Replace the address-keyed calls in your Transport with the address-less members:
| Change this | To this |
|---|---|
Bind(address, router) |
Bind(router) |
Unbind(address) |
Unbind() |
Resolve(address) |
BoundRouter |
NotifyDisconnected(address) |
NotifyDisconnected() |
Before:
Bind(nvrAddress, nvr.Functions.Connection);
if (Resolve(nvrAddress) is not ConnectionFunction connection)
return;
await connection.Dispatch(alert, ct);
NotifyDisconnected(nvrAddress);
After:
Bind(nvr.Functions.Connection);
if (BoundRouter is not ConnectionFunction connection)
return;
await connection.Dispatch(alert, ct);
NotifyDisconnected();
Leave transport.type: custom and your address_type unchanged — address_type still types the protocol
address your Protocol uses. The warnings are gone once no address-keyed transport call remains.
Step 3 — Multi-device: declare multiplex¶
Set the transport type; keep address_type as the id your device carries:
Now Bind(address, router), Unbind(address), Resolve(address) and NotifyDisconnected(address, reason)
resolve against the framework's multiplex transport — your existing calls compile unchanged and the
deprecation warnings are gone. Keep the two contracts in
Transport types → many devices: unbind before
rebinding a reused address, and NotifyDisconnected(address) does not unbind.