File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ module.exports = function(RED) {
66
66
67
67
this . on ( "input" , function ( msg ) {
68
68
if ( msg . payload == false ) {
69
- if ( node . ad ) { node . ad . stop ( ) ; }
69
+ this . stop ( ) ;
70
70
}
71
71
else {
72
72
var service = node . service || msg . service ;
@@ -76,9 +76,10 @@ module.exports = function(RED) {
76
76
options . name = ( node . name || msg . name ) . replace ( / \% h / g, os . hostname ( ) ) ;
77
77
}
78
78
if ( node . txt || msg . txtRecord ) { options . txtRecord = node . txt || msg . txtRecord }
79
- if ( node . ad ) { node . ad . stop ( ) ; }
79
+ this . stop ( ) ;
80
80
node . ad = mdns . createAdvertisement ( service , port , options ) ;
81
81
node . ad . start ( ) ;
82
+ node . status ( { fill : "green" , shape : "dot" } ) ;
82
83
}
83
84
} ) ;
84
85
@@ -87,9 +88,16 @@ module.exports = function(RED) {
87
88
} ) ;
88
89
89
90
this . on ( "close" , function ( ) {
90
- if ( node . ad ) { node . ad . stop ( ) ; }
91
+ this . stop ( ) ;
91
92
} ) ;
92
93
94
+ this . stop = function ( ) {
95
+ if ( node . ad ) {
96
+ node . ad . stop ( ) ;
97
+ node . status ( { fill : "red" , shape : "ring" } ) ;
98
+ }
99
+ }
100
+
93
101
}
94
102
RED . nodes . registerType ( "announce" , MdnsAnnNode ) ;
95
103
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " node-red-node-discovery" ,
3
- "version" : " 0.0.19 " ,
3
+ "version" : " 0.0.20 " ,
4
4
"description" : " A Node-RED node that uses Bonjour / Avahi to discover nearby services." ,
5
5
"dependencies" : {
6
6
"mdns" : " ~2.3.3"
You can’t perform that action at this time.
0 commit comments