@matter/node 0.17.0-alpha.0-20260507-059f7763b → 0.17.0-alpha.0-20260508-96d5c3a88
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/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts +6 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningClient.js +2 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningClient.js.map +1 -1
- package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js +2 -2
- package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
- package/dist/cjs/behavior/system/controller/discovery/DiscoveryError.d.ts +0 -1
- package/dist/cjs/behavior/system/controller/discovery/DiscoveryError.d.ts.map +1 -1
- package/dist/cjs/behavior/system/controller/discovery/DiscoveryError.js +0 -6
- package/dist/cjs/behavior/system/controller/discovery/DiscoveryError.js.map +1 -1
- package/dist/cjs/behavior/system/network/NetworkClient.d.ts.map +1 -1
- package/dist/cjs/behavior/system/network/NetworkClient.js +9 -9
- package/dist/cjs/behavior/system/network/NetworkClient.js.map +1 -1
- package/dist/cjs/behavior/system/network/ServerNetworkRuntime.d.ts.map +1 -1
- package/dist/cjs/behavior/system/network/ServerNetworkRuntime.js +7 -0
- package/dist/cjs/behavior/system/network/ServerNetworkRuntime.js.map +1 -1
- package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js +2 -2
- package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
- package/dist/cjs/endpoint/Endpoint.d.ts +1 -1
- package/dist/cjs/endpoint/Endpoint.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts +6 -1
- package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningClient.js +3 -1
- package/dist/esm/behavior/system/commissioning/CommissioningClient.js.map +1 -1
- package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js +3 -3
- package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
- package/dist/esm/behavior/system/controller/discovery/DiscoveryError.d.ts +0 -1
- package/dist/esm/behavior/system/controller/discovery/DiscoveryError.d.ts.map +1 -1
- package/dist/esm/behavior/system/controller/discovery/DiscoveryError.js +0 -6
- package/dist/esm/behavior/system/controller/discovery/DiscoveryError.js.map +1 -1
- package/dist/esm/behavior/system/network/NetworkClient.d.ts.map +1 -1
- package/dist/esm/behavior/system/network/NetworkClient.js +16 -10
- package/dist/esm/behavior/system/network/NetworkClient.js.map +1 -1
- package/dist/esm/behavior/system/network/ServerNetworkRuntime.d.ts.map +1 -1
- package/dist/esm/behavior/system/network/ServerNetworkRuntime.js +8 -0
- package/dist/esm/behavior/system/network/ServerNetworkRuntime.js.map +1 -1
- package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js +2 -2
- package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
- package/dist/esm/endpoint/Endpoint.d.ts +1 -1
- package/dist/esm/endpoint/Endpoint.d.ts.map +1 -1
- package/package.json +7 -10
- package/src/behavior/system/commissioning/CommissioningClient.ts +10 -2
- package/src/behavior/system/commissioning/RemoteDescriptor.ts +4 -3
- package/src/behavior/system/controller/discovery/DiscoveryError.ts +1 -8
- package/src/behavior/system/network/NetworkClient.ts +23 -14
- package/src/behavior/system/network/ServerNetworkRuntime.ts +12 -0
- package/src/behavior/system/subscriptions/SubscriptionsServer.ts +2 -2
- package/src/endpoint/Endpoint.ts +1 -1
|
@@ -10,9 +10,16 @@ import { ClientNodePhysicalProperties } from "#node/client/ClientNodePhysicalPro
|
|
|
10
10
|
import type { ClientNode } from "#node/ClientNode.js";
|
|
11
11
|
import { Node } from "#node/Node.js";
|
|
12
12
|
import { ClientCacheBuffer } from "#storage/client/ClientCacheBuffer.js";
|
|
13
|
-
import { ChannelType, Observable, ServerAddress
|
|
13
|
+
import { ChannelType, Observable, ServerAddress } from "@matter/general";
|
|
14
14
|
import { DatatypeModel, FieldElement } from "@matter/model";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
ClientSubscription,
|
|
17
|
+
OperationalAddress,
|
|
18
|
+
PeerSet,
|
|
19
|
+
Subscribe,
|
|
20
|
+
SustainedSubscription,
|
|
21
|
+
Val,
|
|
22
|
+
} from "@matter/protocol";
|
|
16
23
|
import { EventNumber } from "@matter/types";
|
|
17
24
|
import { ClientNetworkRuntime } from "./ClientNetworkRuntime.js";
|
|
18
25
|
import { NetworkBehavior } from "./NetworkBehavior.js";
|
|
@@ -41,13 +48,15 @@ export class NetworkClient extends NetworkBehavior {
|
|
|
41
48
|
if (!peerSet.has(peerAddress)) {
|
|
42
49
|
const ipAddresses = this.#node.state.commissioning.addresses?.filter(a => ServerAddress.isIp(a)) ?? [];
|
|
43
50
|
if (ipAddresses.length) {
|
|
44
|
-
const operationalAddress = ServerAddress(ipAddresses[0])
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
const operationalAddress = OperationalAddress.from(ServerAddress(ipAddresses[0]));
|
|
52
|
+
if (operationalAddress !== undefined) {
|
|
53
|
+
// Make sure the PeerSet knows about this peer now too
|
|
54
|
+
peerSet.addKnownPeer({
|
|
55
|
+
address: peerAddress,
|
|
56
|
+
operationalAddress,
|
|
57
|
+
discoveryData: RemoteDescriptor.fromLongForm(this.#node.state.commissioning),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
|
|
@@ -57,12 +66,12 @@ export class NetworkClient extends NetworkBehavior {
|
|
|
57
66
|
peer.physicalProperties = ClientNodePhysicalProperties(this.#node);
|
|
58
67
|
|
|
59
68
|
// Set transport preference: per-peer override from NetworkClient, or inherit
|
|
60
|
-
// from the controller (owner) NetworkServer default.
|
|
69
|
+
// from the controller (owner) NetworkServer default. Explicit "udp" clears any
|
|
70
|
+
// controller-wide TCP default already applied by PeerSet.#applyDefaultPreference.
|
|
61
71
|
const pref =
|
|
62
|
-
this.state.transportPreference ??
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
72
|
+
this.state.transportPreference ??
|
|
73
|
+
(this.#node.owner?.state as Record<string, Val.Struct> | undefined)?.network?.transportPreference;
|
|
74
|
+
peer.transportPreference = pref === "tcp" ? ChannelType.TCP : undefined;
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
|
|
@@ -9,6 +9,7 @@ import type { ServerNode } from "#node/ServerNode.js";
|
|
|
9
9
|
import { InteractionServer } from "#node/server/InteractionServer.js";
|
|
10
10
|
import {
|
|
11
11
|
AddressInUseError,
|
|
12
|
+
ChannelType,
|
|
12
13
|
Crypto,
|
|
13
14
|
InterfaceType,
|
|
14
15
|
Logger,
|
|
@@ -327,6 +328,17 @@ export class ServerNetworkRuntime extends NetworkRuntime {
|
|
|
327
328
|
advertiser.supportedTransports = { tcpClient: tcpConfig.outgoing, tcpServer: tcpConfig.incoming };
|
|
328
329
|
}
|
|
329
330
|
|
|
331
|
+
// Apply default outgoing transport preference to peers created by this controller, so
|
|
332
|
+
// peers used during commissioning (before their per-peer NetworkClient hook runs) inherit
|
|
333
|
+
// the TCP preference and use it for the post-commissioning Reconnect step.
|
|
334
|
+
if (owner.state.network.transportPreference === "tcp") {
|
|
335
|
+
if (tcpConfig.outgoing) {
|
|
336
|
+
env.get(PeerSet).transportPreference = ChannelType.TCP;
|
|
337
|
+
} else {
|
|
338
|
+
logger.warn("transportPreference is 'tcp' but outgoing TCP is disabled; preference ignored");
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
330
342
|
await this.addBroadcasters(advertiser);
|
|
331
343
|
|
|
332
344
|
await owner.act("start-network", agent => agent.load(ProductDescriptionServer));
|
|
@@ -228,13 +228,13 @@ export class SubscriptionsServer extends Behavior {
|
|
|
228
228
|
const { operationalAddress } = peer.descriptor;
|
|
229
229
|
|
|
230
230
|
// If the peer's last known address was TCP, prefer TCP for re-establishment
|
|
231
|
-
const
|
|
231
|
+
const preferredTransport =
|
|
232
232
|
operationalAddress && "type" in operationalAddress && operationalAddress.type === "tcp"
|
|
233
233
|
? ChannelType.TCP
|
|
234
234
|
: undefined;
|
|
235
235
|
session = await peer.connect({
|
|
236
236
|
connectionTimeout: REESTABLISH_SUBSCRIPTIONS_TIMEOUT,
|
|
237
|
-
|
|
237
|
+
preferredTransport,
|
|
238
238
|
});
|
|
239
239
|
if (GroupSession.is(session)) {
|
|
240
240
|
// Should never happen but add for easier typing
|
package/src/endpoint/Endpoint.ts
CHANGED
|
@@ -459,7 +459,7 @@ export class Endpoint<T extends EndpointType = EndpointType.Empty> {
|
|
|
459
459
|
* This is the recommended way to access events for a specific behavior because it provides proper type checking
|
|
460
460
|
* and enforces the correctness of the used Behavior type including all enabled features.
|
|
461
461
|
*/
|
|
462
|
-
eventsOf<T extends Behavior.Type>(type: T
|
|
462
|
+
eventsOf<T extends Behavior.Type>(type: T): Behavior.EventsOf<T>;
|
|
463
463
|
|
|
464
464
|
eventsOf(type: Behavior.Type | string): unknown {
|
|
465
465
|
if (typeof type === "string") {
|