matterbridge 3.4.0 → 3.4.1-dev-20251127-826b2bf
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/CHANGELOG.md +128 -112
- package/README-DEV.md +2 -2
- package/README-DOCKER.md +1 -1
- package/README-MACOS-PLIST.md +1 -1
- package/README-NGINX.md +1 -1
- package/README-PODMAN.md +1 -1
- package/README-SERVICE-LOCAL.md +1 -1
- package/README-SERVICE-OPT.md +6 -1
- package/README-SERVICE.md +1 -1
- package/README.md +57 -49
- package/dist/broadcastServer.js +1 -93
- package/dist/broadcastServerTypes.js +0 -24
- package/dist/cli.js +1 -97
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.js +0 -38
- package/dist/clusters/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -24
- package/dist/deviceManager.js +1 -113
- package/dist/devices/airConditioner.js +0 -57
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/cooktop.js +0 -56
- package/dist/devices/dishwasher.js +0 -57
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.js +0 -5
- package/dist/devices/extractorHood.js +0 -43
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.js +3 -62
- package/dist/devices/laundryWasher.js +4 -70
- package/dist/devices/microwaveOven.js +5 -88
- package/dist/devices/oven.js +0 -85
- package/dist/devices/refrigerator.js +0 -102
- package/dist/devices/roboticVacuumCleaner.js +9 -100
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/speaker.js +0 -84
- package/dist/devices/temperatureControl.js +3 -24
- package/dist/devices/waterHeater.js +2 -82
- package/dist/dgram/coap.js +13 -126
- package/dist/dgram/dgram.js +2 -114
- package/dist/dgram/mb_coap.js +3 -41
- package/dist/dgram/mb_mdns.js +15 -80
- package/dist/dgram/mdns.js +137 -299
- package/dist/dgram/multicast.js +1 -62
- package/dist/dgram/unicast.js +0 -54
- package/dist/frontend.js +35 -455
- package/dist/frontendTypes.js +0 -45
- package/dist/helpers.js +0 -53
- package/dist/index.js +0 -25
- package/dist/jestutils/export.js +0 -1
- package/dist/jestutils/jestHelpers.js +13 -352
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -3
- package/dist/matter/types.js +0 -3
- package/dist/matterNode.js +8 -369
- package/dist/matterbridge.js +74 -788
- package/dist/matterbridgeAccessoryPlatform.js +0 -38
- package/dist/matterbridgeBehaviors.js +5 -68
- package/dist/matterbridgeDeviceTypes.js +14 -635
- package/dist/matterbridgeDynamicPlatform.js +0 -38
- package/dist/matterbridgeEndpoint.js +53 -1444
- package/dist/matterbridgeEndpointHelpers.js +20 -483
- package/dist/matterbridgeEndpointTypes.js +0 -25
- package/dist/matterbridgePlatform.js +2 -460
- package/dist/matterbridgeTypes.js +0 -26
- package/dist/pluginManager.js +5 -340
- package/dist/shelly.js +7 -168
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -69
- package/dist/utils/colorUtils.js +2 -97
- package/dist/utils/commandLine.js +0 -60
- package/dist/utils/copyDirectory.js +0 -37
- package/dist/utils/createDirectory.js +0 -33
- package/dist/utils/createZip.js +2 -47
- package/dist/utils/deepCopy.js +0 -39
- package/dist/utils/deepEqual.js +1 -72
- package/dist/utils/error.js +0 -41
- package/dist/utils/export.js +0 -1
- package/dist/utils/format.js +0 -49
- package/dist/utils/hex.js +0 -124
- package/dist/utils/inspector.js +1 -69
- package/dist/utils/isvalid.js +0 -101
- package/dist/utils/network.js +5 -96
- package/dist/utils/spawn.js +1 -71
- package/dist/utils/tracker.js +1 -64
- package/dist/utils/wait.js +8 -60
- package/frontend/build/assets/index.js +4 -4
- package/frontend/build/assets/vendor_mui.js +1 -1
- package/frontend/build/assets/vendor_node_modules.js +19 -83
- package/frontend/build/assets/vendor_qrcode.js +1 -9
- package/frontend/build/assets/vendor_rjsf.js +1 -9
- package/frontend/package-lock.json +229 -439
- package/frontend/package.json +15 -15
- package/marked.ps1 +15 -0
- package/npm-shrinkwrap.json +165 -231
- package/package.json +2 -3
- package/dist/broadcastServer.d.ts +0 -115
- package/dist/broadcastServer.d.ts.map +0 -1
- package/dist/broadcastServer.js.map +0 -1
- package/dist/broadcastServerTypes.d.ts +0 -838
- package/dist/broadcastServerTypes.d.ts.map +0 -1
- package/dist/broadcastServerTypes.js.map +0 -1
- package/dist/cli.d.ts +0 -30
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts +0 -50
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.js.map +0 -1
- package/dist/cliHistory.d.ts +0 -48
- package/dist/cliHistory.d.ts.map +0 -1
- package/dist/cliHistory.js.map +0 -1
- package/dist/clusters/export.d.ts +0 -2
- package/dist/clusters/export.d.ts.map +0 -1
- package/dist/clusters/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -28
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -135
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/airConditioner.d.ts +0 -98
- package/dist/devices/airConditioner.d.ts.map +0 -1
- package/dist/devices/airConditioner.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts +0 -48
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/cooktop.d.ts +0 -61
- package/dist/devices/cooktop.d.ts.map +0 -1
- package/dist/devices/cooktop.js.map +0 -1
- package/dist/devices/dishwasher.d.ts +0 -71
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts +0 -76
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts +0 -17
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/extractorHood.d.ts +0 -46
- package/dist/devices/extractorHood.d.ts.map +0 -1
- package/dist/devices/extractorHood.js.map +0 -1
- package/dist/devices/heatPump.d.ts +0 -47
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts +0 -67
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts +0 -81
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/microwaveOven.d.ts +0 -168
- package/dist/devices/microwaveOven.d.ts.map +0 -1
- package/dist/devices/microwaveOven.js.map +0 -1
- package/dist/devices/oven.d.ts +0 -105
- package/dist/devices/oven.d.ts.map +0 -1
- package/dist/devices/oven.js.map +0 -1
- package/dist/devices/refrigerator.d.ts +0 -118
- package/dist/devices/refrigerator.d.ts.map +0 -1
- package/dist/devices/refrigerator.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts +0 -40
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/speaker.d.ts +0 -87
- package/dist/devices/speaker.d.ts.map +0 -1
- package/dist/devices/speaker.js.map +0 -1
- package/dist/devices/temperatureControl.d.ts +0 -166
- package/dist/devices/temperatureControl.d.ts.map +0 -1
- package/dist/devices/temperatureControl.js.map +0 -1
- package/dist/devices/waterHeater.d.ts +0 -111
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/dgram/coap.d.ts +0 -205
- package/dist/dgram/coap.d.ts.map +0 -1
- package/dist/dgram/coap.js.map +0 -1
- package/dist/dgram/dgram.d.ts +0 -141
- package/dist/dgram/dgram.d.ts.map +0 -1
- package/dist/dgram/dgram.js.map +0 -1
- package/dist/dgram/mb_coap.d.ts +0 -24
- package/dist/dgram/mb_coap.d.ts.map +0 -1
- package/dist/dgram/mb_coap.js.map +0 -1
- package/dist/dgram/mb_mdns.d.ts +0 -24
- package/dist/dgram/mb_mdns.d.ts.map +0 -1
- package/dist/dgram/mb_mdns.js.map +0 -1
- package/dist/dgram/mdns.d.ts +0 -290
- package/dist/dgram/mdns.d.ts.map +0 -1
- package/dist/dgram/mdns.js.map +0 -1
- package/dist/dgram/multicast.d.ts +0 -67
- package/dist/dgram/multicast.d.ts.map +0 -1
- package/dist/dgram/multicast.js.map +0 -1
- package/dist/dgram/unicast.d.ts +0 -56
- package/dist/dgram/unicast.d.ts.map +0 -1
- package/dist/dgram/unicast.js.map +0 -1
- package/dist/frontend.d.ts +0 -238
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/frontendTypes.d.ts +0 -529
- package/dist/frontendTypes.d.ts.map +0 -1
- package/dist/frontendTypes.js.map +0 -1
- package/dist/helpers.d.ts +0 -48
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -34
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/jestutils/export.d.ts +0 -2
- package/dist/jestutils/export.d.ts.map +0 -1
- package/dist/jestutils/export.js.map +0 -1
- package/dist/jestutils/jestHelpers.d.ts +0 -303
- package/dist/jestutils/jestHelpers.d.ts.map +0 -1
- package/dist/jestutils/jestHelpers.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterNode.d.ts +0 -342
- package/dist/matterNode.d.ts.map +0 -1
- package/dist/matterNode.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -473
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -41
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -2404
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -698
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -41
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -1507
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -787
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgeEndpointTypes.d.ts +0 -166
- package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
- package/dist/matterbridgeEndpointTypes.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -524
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -251
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -371
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -174
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -75
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -101
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -66
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -35
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -34
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -39
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -32
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -54
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/error.d.ts +0 -44
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/export.d.ts +0 -13
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/format.d.ts +0 -53
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -89
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/inspector.d.ts +0 -87
- package/dist/utils/inspector.d.ts.map +0 -1
- package/dist/utils/inspector.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -103
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -111
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -33
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/tracker.d.ts +0 -108
- package/dist/utils/tracker.d.ts.map +0 -1
- package/dist/utils/tracker.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -54
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
package/README-DEV.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge development
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
|
@@ -22,7 +22,7 @@ The easiest way is to clone the [Matterbridge Plugin Template](https://github.co
|
|
|
22
22
|
|
|
23
23
|
After you clone it locally, change the name (keep always matterbridge- at the beginning of the name), version, description, author, homepage, repository, bugs and funding in the package.json.
|
|
24
24
|
|
|
25
|
-
It is also possible to add two custom properties to the package.json: **help** and **changelog** with a url that will be used in the frontend instead of the default (/blob/main/README
|
|
25
|
+
It is also possible to add two custom properties to the package.json: **help** and **changelog** with a url that will be used in the frontend instead of the default (/blob/main/README and /blob/main/CHANGELOG).
|
|
26
26
|
|
|
27
27
|
Add your plugin logic in module.ts.
|
|
28
28
|
|
package/README-DOCKER.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge docker configuration
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
package/README-MACOS-PLIST.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge launchctl configuration (macOS)
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
package/README-NGINX.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge NGINX configuration
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
package/README-PODMAN.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge Podman configuration
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
package/README-SERVICE-LOCAL.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge systemd configuration with local global node_modules
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
package/README-SERVICE-OPT.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge systemd configuration with private global node_modules
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
|
@@ -22,8 +22,12 @@ The advantage of this setup is that the global node_modules are private for matt
|
|
|
22
22
|
|
|
23
23
|
The service runs with group and user matterbridge and the system has full protection.
|
|
24
24
|
|
|
25
|
+
### Important
|
|
26
|
+
|
|
25
27
|
The storage position is **not compatible** with the traditional setup (~/Matterbridge ~/.matterbridge ~/.mattercert).
|
|
26
28
|
|
|
29
|
+
Also various script don't work if you choose this configuration.
|
|
30
|
+
|
|
27
31
|
### 1 - Create the matterbridge user and group
|
|
28
32
|
|
|
29
33
|
```bash
|
|
@@ -72,6 +76,7 @@ matterbridge --version
|
|
|
72
76
|
The storage position is **not compatible** with the traditional setup (~/Matterbridge ~/.matterbridge ~/.mattercert).
|
|
73
77
|
|
|
74
78
|
If you are migrating from the traditional service setup, before removing the old diretories, you may want to copy the contents of ~/Matterbridge ~/.matterbridge ~/.mattercert to the new directories /opt/matterbridge/Matterbridge /opt/matterbridge/.matterbridge /opt/matterbridge/.mattercert.
|
|
79
|
+
This will save all the plugin configs and the fabrics but you need to remove all plugins and readd them cause the path will be different.
|
|
75
80
|
|
|
76
81
|
Copy the old diretories content
|
|
77
82
|
|
package/README-SERVICE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge systemd configuration
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="
|
|
1
|
+
# <img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/matterbridge)
|
|
4
4
|
[](https://www.npmjs.com/package/matterbridge)
|
|
@@ -36,21 +36,21 @@ Matterbridge is lightweight and also runs on slow Linux machines with as little
|
|
|
36
36
|
|
|
37
37
|
It runs perfectly on Linux, macOS and Windows.
|
|
38
38
|
|
|
39
|
-
If you like this project and find it useful, please consider giving it a star on GitHub
|
|
39
|
+
If you like this project and find it useful, please consider giving it a star on [GitHub](https://github.com/Luligu/matterbridge) and sponsoring it.
|
|
40
40
|
|
|
41
41
|
<a href="https://www.buymeacoffee.com/luligugithub">
|
|
42
|
-
<img src="bmc-button.svg" alt="Buy me a coffee" width="120">
|
|
42
|
+
<img src="https://matterbridge.io/bmc-button.svg" alt="Buy me a coffee" width="120">
|
|
43
43
|
</a>
|
|
44
44
|
|
|
45
45
|
## Acknowledgements
|
|
46
46
|
|
|
47
|
-
The project is build on top of https://github.com/project-chip/matter.js.
|
|
47
|
+
The project is build on top of [matter.js](https://github.com/project-chip/matter.js).
|
|
48
48
|
|
|
49
49
|
A special thanks to Apollon77 for his incredible work.
|
|
50
50
|
|
|
51
51
|
## Discord
|
|
52
52
|
|
|
53
|
-
Join us in the Matterbridge Discord group
|
|
53
|
+
Join us in the Matterbridge [Discord group](https://discord.gg/QX58CDe6hd) created by [Tamer](https://github.com/tammeryousef1006).
|
|
54
54
|
|
|
55
55
|
## Videos
|
|
56
56
|
|
|
@@ -75,7 +75,7 @@ The supported versions of node are 20 and 22. Please install Node.js 22 LTS. Don
|
|
|
75
75
|
Node.js 23, like all odd-numbered versions, is not supported.
|
|
76
76
|
Nvm is not a good choice and should not be used for production.
|
|
77
77
|
|
|
78
|
-
If you don't have Docker already install, please use this method to install it on a debian device: https://docs.docker.com/
|
|
78
|
+
If you don't have Docker already install, please use this method to install it on a debian device: https://docs.docker.com/engine/install.
|
|
79
79
|
After follow the guidelines for the [Docker configurations](README-DOCKER.md).
|
|
80
80
|
|
|
81
81
|
I suggest using Docker for its simplicity.
|
|
@@ -108,7 +108,7 @@ Test the installation with:
|
|
|
108
108
|
matterbridge
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
Now it is possible to open the frontend at the link provided in the log (e.g. http://MATTERBRIDGE-IPV4-ADDRESS:8283).
|
|
111
|
+
Now it is possible to open the frontend at the link provided in the log (e.g. `http://MATTERBRIDGE-IPV4-ADDRESS:8283`).
|
|
112
112
|
|
|
113
113
|
You can then change the bridge mode and other parameters from the frontend.
|
|
114
114
|
|
|
@@ -117,7 +117,7 @@ You can then change the bridge mode and other parameters from the frontend.
|
|
|
117
117
|
### mode bridge
|
|
118
118
|
|
|
119
119
|
```bash
|
|
120
|
-
matterbridge
|
|
120
|
+
matterbridge --bridge
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
This force Matterbridge to load in bridge mode.
|
|
@@ -127,46 +127,50 @@ Matterbridge only exposes itself, and you have to pair it scanning the QR code s
|
|
|
127
127
|
### mode childbridge
|
|
128
128
|
|
|
129
129
|
```bash
|
|
130
|
-
matterbridge
|
|
130
|
+
matterbridge --childbridge
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
This force Matterbridge to load in childbridge mode.
|
|
134
134
|
|
|
135
135
|
Matterbridge exposes each registered plugins, and you have to pair each one by scanning the QR code shown in the frontend or in the console.
|
|
136
136
|
|
|
137
|
-
### Use matterbridge
|
|
137
|
+
### Use matterbridge --help to see the command line syntax
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
matterbridge
|
|
140
|
+
matterbridge --help
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Use matterbridge --version to see the current version
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
matterbridge --version
|
|
141
147
|
```
|
|
142
148
|
|
|
143
149
|
## Frontend
|
|
144
150
|
|
|
145
|
-
Matterbridge has a frontend available on http://MATTERBIDGE-IPV4-ADDRESS:8283 and http://[MATTERBIDGE-IPV6-ADDRESS]:8283
|
|
151
|
+
Matterbridge has a frontend available on IPv4 `http://localhost:8283` or `http://MATTERBIDGE-IPV4-ADDRESS:8283` and IPv6 `http://[::1]:8283` or `http://[MATTERBIDGE-IPV6-ADDRESS]:8283`.
|
|
146
152
|
|
|
147
153
|
You can change the default port by adding the frontend parameter when you run it.
|
|
148
154
|
|
|
149
155
|
Here's how to specify a different port number:
|
|
150
156
|
|
|
151
157
|
```bash
|
|
152
|
-
matterbridge
|
|
158
|
+
matterbridge --frontend [port number]
|
|
153
159
|
```
|
|
154
160
|
|
|
155
161
|
To use the frontend with ssl see below.
|
|
156
162
|
|
|
157
163
|
From the frontend you can do all operations in an easy way.
|
|
158
164
|
|
|
159
|
-
Home page
|
|
160
|
-

|
|
165
|
+
Home page
|
|
161
166
|
|
|
162
|
-
|
|
163
|
-
[See the screenshot here](screenshot/Screenshot%20devices.jpg)
|
|
167
|
+

|
|
164
168
|
|
|
165
|
-
|
|
166
|
-
[See the screenshot here](screenshot/Screenshot%20logs.jpg)
|
|
169
|
+
[Devices page](./screenshot/Screenshot%20devices.jpg)
|
|
167
170
|
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
[Logs page](./screenshot/Screenshot%20logs.jpg)
|
|
172
|
+
|
|
173
|
+
[Config editor](./screenshot/Screenshot%20config%20editor.jpg)
|
|
170
174
|
|
|
171
175
|
## Advanced configurations
|
|
172
176
|
|
|
@@ -180,6 +184,10 @@ or with local global node_modules (no sudo required)
|
|
|
180
184
|
|
|
181
185
|
[Service configurations with local global node_modules](README-SERVICE-LOCAL.md)
|
|
182
186
|
|
|
187
|
+
or with user matterbridge and with private global node_modules (no sudo required)
|
|
188
|
+
|
|
189
|
+
[Service configurations with user matterbridge and private global node_modules](README-SERVICE-OPT.md)
|
|
190
|
+
|
|
183
191
|
### Run matterbridge as a system service with launchctl (macOS only)
|
|
184
192
|
|
|
185
193
|
[Launchctl configurations](README-MACOS-PLIST.md)
|
|
@@ -213,7 +221,7 @@ The other Home Assistant Community Add-ons and plugins are not verified to work
|
|
|
213
221
|
### Shelly
|
|
214
222
|
|
|
215
223
|
<a href="https://github.com/Luligu/matterbridge-shelly">
|
|
216
|
-
<img src="screenshot/Shelly.svg" alt="Shelly plugin logo" width="100" />
|
|
224
|
+
<img src="./screenshot/Shelly.svg" alt="Shelly plugin logo" width="100" />
|
|
217
225
|
</a>
|
|
218
226
|
|
|
219
227
|
Matterbridge shelly plugin allows you to expose all Shelly Gen 1, Gen 2, Gen 3 and Gen 4 and BLU devices to Matter.
|
|
@@ -242,7 +250,7 @@ Features:
|
|
|
242
250
|
### Zigbee2MQTT
|
|
243
251
|
|
|
244
252
|
<a href="https://github.com/Luligu/matterbridge-zigbee2mqtt">
|
|
245
|
-
<img src="screenshot/Zigbee2MQTT.svg" alt="Zigbee2MQTT plugin logo" width="100" />
|
|
253
|
+
<img src="./screenshot/Zigbee2MQTT.svg" alt="Zigbee2MQTT plugin logo" width="100" />
|
|
246
254
|
</a>
|
|
247
255
|
|
|
248
256
|
Matterbridge zigbee2mqtt is a matterbridge production-level plugin that expose all zigbee2mqtt devices and groups to Matter.
|
|
@@ -252,7 +260,7 @@ No hub or dedicated hardware needed.
|
|
|
252
260
|
### Somfy tahoma
|
|
253
261
|
|
|
254
262
|
<a href="https://github.com/Luligu/matterbridge-somfy-tahoma">
|
|
255
|
-
<img src="screenshot/Somfy.svg" alt="Somfy plugin logo" width="100" />
|
|
263
|
+
<img src="./screenshot/Somfy.svg" alt="Somfy plugin logo" width="100" />
|
|
256
264
|
</a>
|
|
257
265
|
|
|
258
266
|
Matterbridge Somfy Tahoma is a matterbridge production-level plugin that expose the Somfy Tahoma screen devices to Matter.
|
|
@@ -260,17 +268,17 @@ Matterbridge Somfy Tahoma is a matterbridge production-level plugin that expose
|
|
|
260
268
|
### Home Assistant
|
|
261
269
|
|
|
262
270
|
<a href="https://github.com/Luligu/matterbridge-hass">
|
|
263
|
-
<img src="screenshot/HomeAssistant.svg" alt="Hass logo" width="100" />
|
|
271
|
+
<img src="./screenshot/HomeAssistant.svg" alt="Hass logo" width="100" />
|
|
264
272
|
</a>
|
|
265
273
|
|
|
266
274
|
Matterbridge Home Assistant plugin allows you to expose the Home Assistant devices and entities to Matter.
|
|
267
275
|
|
|
268
|
-
It is the ideal companion of the official [Matterbridge Home Assistant Add-on](https://github.com/Luligu/matterbridge-home-assistant-addon
|
|
276
|
+
It is the ideal companion of the official [Matterbridge Home Assistant Add-on](https://github.com/Luligu/matterbridge-home-assistant-addon).
|
|
269
277
|
|
|
270
278
|
### Webhooks
|
|
271
279
|
|
|
272
280
|
<a href="https://github.com/Luligu/matterbridge-webhooks">
|
|
273
|
-
<img src="
|
|
281
|
+
<img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge logo" width="100" />
|
|
274
282
|
</a>
|
|
275
283
|
|
|
276
284
|
Matterbridge Webhooks plugin allows you to expose any webhooks to Matter.
|
|
@@ -278,7 +286,7 @@ Matterbridge Webhooks plugin allows you to expose any webhooks to Matter.
|
|
|
278
286
|
### BTHome
|
|
279
287
|
|
|
280
288
|
<a href="https://github.com/Luligu/matterbridge-webhooks">
|
|
281
|
-
<img src="
|
|
289
|
+
<img src="https://matterbridge.io/matterbridge.svg" alt="Matterbridge logo" width="100" />
|
|
282
290
|
</a>
|
|
283
291
|
|
|
284
292
|
Matterbridge BTHome allows you to expose any BTHome device to Matter using the native bluetooth of the host machine.
|
|
@@ -370,58 +378,58 @@ On windows:
|
|
|
370
378
|
|
|
371
379
|
```powershell
|
|
372
380
|
cd $HOME\Matterbridge
|
|
373
|
-
npm install -g matterbridge-zigbee2mqtt
|
|
374
|
-
matterbridge
|
|
381
|
+
npm install -g matterbridge-zigbee2mqtt --omit=dev
|
|
382
|
+
matterbridge --add matterbridge-zigbee2mqtt
|
|
375
383
|
```
|
|
376
384
|
|
|
377
385
|
On linux or macOS:
|
|
378
386
|
|
|
379
387
|
```bash
|
|
380
388
|
cd ~/Matterbridge
|
|
381
|
-
sudo npm install -g matterbridge-zigbee2mqtt
|
|
382
|
-
matterbridge
|
|
389
|
+
sudo npm install -g matterbridge-zigbee2mqtt --omit=dev
|
|
390
|
+
matterbridge --add matterbridge-zigbee2mqtt
|
|
383
391
|
```
|
|
384
392
|
|
|
385
393
|
## How to add a plugin to Matterbridge from a terminal
|
|
386
394
|
|
|
387
395
|
```bash
|
|
388
|
-
matterbridge
|
|
396
|
+
matterbridge --add [plugin path or plugin name]
|
|
389
397
|
```
|
|
390
398
|
|
|
391
399
|
## How to remove a plugin from Matterbridge from a terminal
|
|
392
400
|
|
|
393
401
|
```bash
|
|
394
|
-
matterbridge
|
|
402
|
+
matterbridge --remove [plugin path or plugin name]
|
|
395
403
|
```
|
|
396
404
|
|
|
397
405
|
## How to disable a registered plugin from a terminal
|
|
398
406
|
|
|
399
407
|
```bash
|
|
400
|
-
matterbridge
|
|
408
|
+
matterbridge --disable [plugin path or plugin name]
|
|
401
409
|
```
|
|
402
410
|
|
|
403
411
|
## How to enable a registered plugin from a terminal
|
|
404
412
|
|
|
405
413
|
```bash
|
|
406
|
-
matterbridge
|
|
414
|
+
matterbridge --enable [plugin path or plugin name]
|
|
407
415
|
```
|
|
408
416
|
|
|
409
417
|
## How to remove the commissioning information for Matterbridge so you can pair it again (bridge mode). Shutdown Matterbridge before!
|
|
410
418
|
|
|
411
419
|
```bash
|
|
412
|
-
matterbridge
|
|
420
|
+
matterbridge --reset
|
|
413
421
|
```
|
|
414
422
|
|
|
415
423
|
## How to remove the commissioning information for a registered plugin so you can pair it again (childbridge mode). Shutdown Matterbridge before!
|
|
416
424
|
|
|
417
425
|
```bash
|
|
418
|
-
matterbridge
|
|
426
|
+
matterbridge --reset [plugin path or plugin name]
|
|
419
427
|
```
|
|
420
428
|
|
|
421
429
|
## How to factory reset Matterbridge. Shutdown Matterbridge before!
|
|
422
430
|
|
|
423
431
|
```bash
|
|
424
|
-
matterbridge
|
|
432
|
+
matterbridge --factoryreset
|
|
425
433
|
```
|
|
426
434
|
|
|
427
435
|
This will reset the internal storages. All commissioning informations will be lost. All plugins will be unregistered.
|
|
@@ -438,7 +446,7 @@ Place your own certificates in the `.matterbridge/cert` directory:
|
|
|
438
446
|
- `key.pem`
|
|
439
447
|
- `ca.pem` (optional)
|
|
440
448
|
|
|
441
|
-

|
|
449
|
+

|
|
442
450
|
|
|
443
451
|
Matterbridge looks first for .p12 certificate and if it is not found it looks for cert.pem and key.pem.
|
|
444
452
|
|
|
@@ -453,27 +461,27 @@ Matterbridge looks first for .p12 certificate and if it is not found it looks fo
|
|
|
453
461
|
|
|
454
462
|
### Change the command line
|
|
455
463
|
|
|
456
|
-
Add the
|
|
464
|
+
Add the **--ssl** parameter to the command line.
|
|
457
465
|
|
|
458
466
|
If desired, you can also change the frontend port with **-frontend 443**.
|
|
459
467
|
|
|
460
468
|
```bash
|
|
461
|
-
matterbridge
|
|
469
|
+
matterbridge --ssl --frontend 443
|
|
462
470
|
```
|
|
463
471
|
|
|
464
|
-
Add the
|
|
472
|
+
Add the **--mtls** parameter to the command line if you want Matterbridge to request the client (your browser) to authenticate itself (this is the most secure connection possible).
|
|
465
473
|
|
|
466
474
|
The browser must provide the client certificate: on Windows you need to import it in Current User → Personal → Certificates with certmgr.msc.
|
|
467
475
|
|
|
468
476
|
```bash
|
|
469
|
-
matterbridge
|
|
477
|
+
matterbridge --ssl --mtls --frontend 443
|
|
470
478
|
```
|
|
471
479
|
|
|
472
480
|
### Restart
|
|
473
481
|
|
|
474
482
|
If the certificate are correctly configured, you will be able to connect with https to the frontend.
|
|
475
483
|
|
|
476
|
-

|
|
484
|
+

|
|
477
485
|
|
|
478
486
|
## How to send the debug log files
|
|
479
487
|
|
|
@@ -481,9 +489,9 @@ If the certificate are correctly configured, you will be able to connect with ht
|
|
|
481
489
|
|
|
482
490
|
In the frontend, go to settings and enable debug mode as shown below:
|
|
483
491
|
|
|
484
|
-

|
|
492
|
+

|
|
485
493
|
|
|
486
|
-

|
|
494
|
+

|
|
487
495
|
|
|
488
496
|
### Restart
|
|
489
497
|
|
|
@@ -491,7 +499,7 @@ Wait a few minutes to allow the logs to to accumulate.
|
|
|
491
499
|
|
|
492
500
|
Then, from the dots menu in the frontend, download the `matterbridge.log` and `matter.log` files.
|
|
493
501
|
|
|
494
|
-

|
|
502
|
+

|
|
495
503
|
|
|
496
504
|
Don't forget to unselect the debug mode when is no more needed. The network traffic and cpu usage is very high in debug mode.
|
|
497
505
|
|
|
@@ -586,7 +594,7 @@ On my side I sponsor the packages that I use in this project. It would be nice t
|
|
|
586
594
|
Click on the badge below to get started:
|
|
587
595
|
|
|
588
596
|
<a href="https://www.buymeacoffee.com/luligugithub">
|
|
589
|
-
<img src="bmc-button.svg" alt="Buy me a coffee" width="120">
|
|
597
|
+
<img src="https://matterbridge.io/bmc-button.svg" alt="Buy me a coffee" width="120">
|
|
590
598
|
</a>
|
|
591
599
|
|
|
592
600
|
Thank you for your support!
|
package/dist/broadcastServer.js
CHANGED
|
@@ -1,36 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the BroadcastServer class.
|
|
3
|
-
*
|
|
4
|
-
* @file broadcastServer.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2025-10-05
|
|
7
|
-
* @version 1.0.3
|
|
8
|
-
* @license Apache-2.0
|
|
9
|
-
*
|
|
10
|
-
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
// eslint-disable-next-line no-console
|
|
25
1
|
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
26
2
|
console.log('\u001B[32mBroadcastServer loaded.\u001B[40;0m');
|
|
27
3
|
import { EventEmitter } from 'node:events';
|
|
28
4
|
import { BroadcastChannel } from 'node:worker_threads';
|
|
29
5
|
import { CYAN, db, debugStringify } from 'node-ansi-logger';
|
|
30
6
|
import { hasParameter } from './utils/commandLine.js';
|
|
31
|
-
/**
|
|
32
|
-
* BroadcastServer class to handle broadcast messages between workers with BroadcastChannel.
|
|
33
|
-
*/
|
|
34
7
|
export class BroadcastServer extends EventEmitter {
|
|
35
8
|
name;
|
|
36
9
|
log;
|
|
@@ -38,13 +11,6 @@ export class BroadcastServer extends EventEmitter {
|
|
|
38
11
|
broadcastChannel;
|
|
39
12
|
debug = hasParameter('debug') || hasParameter('verbose');
|
|
40
13
|
verbose = hasParameter('verbose');
|
|
41
|
-
/**
|
|
42
|
-
* Creates an instance of BroadcastServer.
|
|
43
|
-
*
|
|
44
|
-
* @param {string} name - The name of the broadcast server.
|
|
45
|
-
* @param {AnsiLogger} log - The logger instance to use for logging.
|
|
46
|
-
* @param {string} channel - The channel name for the broadcast. Default is 'broadcast-channel'.
|
|
47
|
-
*/
|
|
48
14
|
constructor(name, log, channel = 'broadcast-channel') {
|
|
49
15
|
super();
|
|
50
16
|
this.name = name;
|
|
@@ -53,72 +19,30 @@ export class BroadcastServer extends EventEmitter {
|
|
|
53
19
|
this.broadcastChannel = new BroadcastChannel(this.channel);
|
|
54
20
|
this.broadcastChannel.onmessage = this.broadcastMessageHandler.bind(this);
|
|
55
21
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Closes the broadcast channel.
|
|
58
|
-
*
|
|
59
|
-
* @returns {void}
|
|
60
|
-
*/
|
|
61
22
|
close() {
|
|
62
|
-
// @ts-expect-error: wrong type definition in node.d.ts
|
|
63
23
|
this.broadcastChannel.onmessage = null;
|
|
64
24
|
this.broadcastChannel.close();
|
|
65
25
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Generates a unique ID with range 100000-999999.
|
|
68
|
-
*
|
|
69
|
-
* @returns {number} - A unique ID between 100000 and 999999
|
|
70
|
-
*/
|
|
71
26
|
getUniqueId() {
|
|
72
|
-
return Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000;
|
|
27
|
+
return Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000;
|
|
73
28
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Type guard to check if a message is a request of a specific type.
|
|
76
|
-
*
|
|
77
|
-
* @param {unknown} msg - The message to check.
|
|
78
|
-
* @param {T} type - The type to check against.
|
|
79
|
-
* @returns {msg is WorkerRequest<T>} True if the message is a request of the specified type.
|
|
80
|
-
*/
|
|
81
29
|
isWorkerRequest(msg, type) {
|
|
82
30
|
return typeof msg === 'object' && msg !== null && 'id' in msg && 'timestamp' in msg && 'type' in msg && msg.type === type && !('response' in msg) && 'src' in msg && 'dst' in msg;
|
|
83
31
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Type guard to check if a message is a response of a specific type.
|
|
86
|
-
*
|
|
87
|
-
* @param {unknown} msg - The message to check.
|
|
88
|
-
* @param {T} type - The type to check against.
|
|
89
|
-
* @returns {msg is WorkerResponse<T>} True if the message is a response of the specified type.
|
|
90
|
-
*/
|
|
91
32
|
isWorkerResponse(msg, type) {
|
|
92
33
|
return typeof msg === 'object' && msg !== null && 'id' in msg && 'timestamp' in msg && 'type' in msg && msg.type === type && 'response' in msg && 'src' in msg && 'dst' in msg;
|
|
93
34
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Handles incoming broadcast messages.
|
|
96
|
-
*
|
|
97
|
-
* @param {MessageEvent} event - The message event containing the broadcast message.
|
|
98
|
-
* @returns {void}
|
|
99
|
-
*/
|
|
100
35
|
broadcastMessageHandler(event) {
|
|
101
36
|
const data = event.data;
|
|
102
37
|
if (this.verbose && (data.dst === this.name || data.dst === 'all'))
|
|
103
38
|
this.log.debug(`Server ${CYAN}${this.name}${db} received broadcast message: ${debugStringify(data)}`);
|
|
104
39
|
this.emit('broadcast_message', data);
|
|
105
40
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Broadcast a message to all workers.
|
|
108
|
-
*
|
|
109
|
-
* @param {WorkerMessage} message - The message to broadcast.
|
|
110
|
-
*/
|
|
111
41
|
broadcast(message) {
|
|
112
42
|
if (this.verbose)
|
|
113
43
|
this.log.debug(`Broadcasting message: ${debugStringify(message)}`);
|
|
114
44
|
this.broadcastChannel.postMessage(message);
|
|
115
45
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Broadcast a request message to all workers.
|
|
118
|
-
*
|
|
119
|
-
* @param {WorkerRequest<T>} message - The typed request message to broadcast.
|
|
120
|
-
* @returns {void}
|
|
121
|
-
*/
|
|
122
46
|
request(message) {
|
|
123
47
|
if (message.id === undefined) {
|
|
124
48
|
message.id = this.getUniqueId();
|
|
@@ -134,12 +58,6 @@ export class BroadcastServer extends EventEmitter {
|
|
|
134
58
|
this.log.debug(`Broadcasting request message: ${debugStringify(message)}`);
|
|
135
59
|
this.broadcastChannel.postMessage(message);
|
|
136
60
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Broadcast a response message to all workers.
|
|
139
|
-
*
|
|
140
|
-
* @param {WorkerResponse<T>} message - The typed response message to broadcast.
|
|
141
|
-
* @returns {void}
|
|
142
|
-
*/
|
|
143
61
|
respond(message) {
|
|
144
62
|
if (message.timestamp === undefined) {
|
|
145
63
|
message.timestamp = Date.now();
|
|
@@ -152,15 +70,6 @@ export class BroadcastServer extends EventEmitter {
|
|
|
152
70
|
this.log.debug(`Broadcasting response message: ${debugStringify(message)}`);
|
|
153
71
|
this.broadcastChannel.postMessage(message);
|
|
154
72
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Fetch data from a worker.
|
|
157
|
-
* It broadcasts a request message and waits for a response with the same id.
|
|
158
|
-
*
|
|
159
|
-
* @param {WorkerRequest<T>} message - The typed request message to broadcast.
|
|
160
|
-
* @param {number} timeout - The timeout in milliseconds to wait for a response. Default is 250ms.
|
|
161
|
-
* @returns {Promise<WorkerResponse<T>>} A promise that resolves with the response from the worker or rejects on timeout.
|
|
162
|
-
* @throws {Error} If the fetch operation times out after 250ms.
|
|
163
|
-
*/
|
|
164
73
|
async fetch(message, timeout = 250) {
|
|
165
74
|
if (message.id === undefined) {
|
|
166
75
|
message.id = this.getUniqueId();
|
|
@@ -193,4 +102,3 @@ export class BroadcastServer extends EventEmitter {
|
|
|
193
102
|
});
|
|
194
103
|
}
|
|
195
104
|
}
|
|
196
|
-
//# sourceMappingURL=broadcastServer.js.map
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the BroadcastServer types.
|
|
3
|
-
*
|
|
4
|
-
* @file broadcastServerTypes.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2025-10-05
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
* @license Apache-2.0
|
|
9
|
-
*
|
|
10
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
1
|
export {};
|
|
25
|
-
//# sourceMappingURL=broadcastServerTypes.js.map
|