Add AutoReconnect setting for MQTT client.
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build Docker image / build (push) Successful in 4m46s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build Docker image / build (push) Successful in 4m46s
				
			This commit is contained in:
		
							parent
							
								
									8132344c2a
								
							
						
					
					
						commit
						5be69f9baf
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		
							
								
								
									
										2
									
								
								main.go
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								main.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
// TODO: Optimisation: only log dt1, dt2, rt1, rt2, g on change.
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
| 
						 | 
				
			
			@ -65,6 +66,7 @@ func main() {
 | 
			
		|||
	opts.AddBroker(os.Getenv("MQTT_BROKER"))
 | 
			
		||||
	opts.SetUsername(os.Getenv("MQTT_USERNAME"))
 | 
			
		||||
	opts.SetPassword(os.Getenv("MQTT_PASSWORD"))
 | 
			
		||||
	opts.SetAutoReconnect(true)
 | 
			
		||||
 | 
			
		||||
	// Connect to MQTT broker
 | 
			
		||||
	client := mqtt.NewClient(opts)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue