mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	@@ -79,7 +79,10 @@ MQTTClient.prototype.connect = function(options) {
 | 
				
			|||||||
                        var now = (new Date()).getTime();
 | 
					                        var now = (new Date()).getTime();
 | 
				
			||||||
                        if (now - self.lastOutbound > self.options.keepalive*500 || now - self.lastInbound > self.options.keepalive*500) {
 | 
					                        if (now - self.lastOutbound > self.options.keepalive*500 || now - self.lastInbound > self.options.keepalive*500) {
 | 
				
			||||||
                           if (self.pingOutstanding) {
 | 
					                           if (self.pingOutstanding) {
 | 
				
			||||||
                               self.client.disconnect();
 | 
					                              try {
 | 
				
			||||||
 | 
					                                 self.client.disconnect();
 | 
				
			||||||
 | 
					                              } catch (err) {
 | 
				
			||||||
 | 
					                              }
 | 
				
			||||||
                           } else {
 | 
					                           } else {
 | 
				
			||||||
                              self.lastOutbound = (new Date()).getTime();
 | 
					                              self.lastOutbound = (new Date()).getTime();
 | 
				
			||||||
                              self.lastInbound = (new Date()).getTime();
 | 
					                              self.lastInbound = (new Date()).getTime();
 | 
				
			||||||
@@ -216,7 +219,10 @@ MQTTClient.prototype.disconnect = function() {
 | 
				
			|||||||
   var self = this;
 | 
					   var self = this;
 | 
				
			||||||
   if (this.connected) {
 | 
					   if (this.connected) {
 | 
				
			||||||
       this.connected = false;
 | 
					       this.connected = false;
 | 
				
			||||||
       this.client.disconnect();
 | 
					       try {
 | 
				
			||||||
 | 
					           this.client.disconnect();
 | 
				
			||||||
 | 
					       } catch(err) {
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
MQTTClient.prototype.isConnected = function() {
 | 
					MQTTClient.prototype.isConnected = function() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user