File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## [ 1.1.8]
4+ - Fix connection to remove broker by using the correct client ID pattern
5+
36## [ 1.1.7]
47- Added health check endpoint for better monitoring and automatic recovery
58- Added Docker health check configuration
Original file line number Diff line number Diff line change 11{
22 "name" : " hame-relay" ,
3- "version" : " 1.1.7 " ,
3+ "version" : " 1.1.8 " ,
44 "description" : " MQTT message forwarder between brokers" ,
55 "main" : " dist/forwarder.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -229,6 +229,7 @@ class MQTTForwarder {
229229 private initializeBrokers ( ) : void {
230230 const options = {
231231 keepalive : 30 ,
232+ clientId : this . generateClientId ( )
232233 } ;
233234 this . configBroker = mqtt . connect ( this . config . broker_url , options ) ;
234235
@@ -243,6 +244,14 @@ class MQTTForwarder {
243244 this . setupBrokerEventHandlers ( ) ;
244245 }
245246
247+ private generateClientId ( ) {
248+ let randomClientId = "" ;
249+ for ( let i = 0 ; i < 24 ; i ++ ) {
250+ randomClientId += Math . floor ( Math . random ( ) * 16 ) . toString ( 16 ) ;
251+ }
252+ return `hm_${ randomClientId } ` ;
253+ }
254+
246255 private setupBrokerEventHandlers ( ) : void {
247256 // Config broker event handlers
248257 this . configBroker . on ( 'connect' , ( ) => {
You can’t perform that action at this time.
0 commit comments