python clients fixed 'TypeError: on_connect() takes exactly 3 arguments (4 given)'
This commit is contained in:
		
							parent
							
								
									cdc09f45b9
								
							
						
					
					
						commit
						d570f08750
					
				@ -19,7 +19,7 @@ import paho.mqtt.client as mqtt
 | 
			
		||||
import ssl, socket
 | 
			
		||||
 | 
			
		||||
# The callback for when the client receives a CONNACK response from the server.
 | 
			
		||||
def on_connect(client, userdata, rc):
 | 
			
		||||
def on_connect(client, userdata, rc, *extra_params):
 | 
			
		||||
   print('Connected with result code '+str(rc))
 | 
			
		||||
   # Subscribing in on_connect() means that if we lose the connection and
 | 
			
		||||
   # reconnect then subscriptions will be renewed.
 | 
			
		||||
 | 
			
		||||
@ -18,8 +18,9 @@
 | 
			
		||||
import paho.mqtt.client as mqtt
 | 
			
		||||
 | 
			
		||||
# The callback for when the client receives a CONNACK response from the server.
 | 
			
		||||
def on_connect(client, userdata, rc):
 | 
			
		||||
def on_connect(client, userdata, rc, *extra_params):
 | 
			
		||||
   print('Connected with result code '+str(rc))
 | 
			
		||||
   #print('***' + str(r))
 | 
			
		||||
   # Subscribing in on_connect() means that if we lose the connection and
 | 
			
		||||
   # reconnect then subscriptions will be renewed.
 | 
			
		||||
   client.subscribe('v1/devices/me/attributes')
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ import paho.mqtt.client as mqtt
 | 
			
		||||
import ssl, socket
 | 
			
		||||
 | 
			
		||||
# The callback for when the client receives a CONNACK response from the server.
 | 
			
		||||
def on_connect(client, userdata, rc):
 | 
			
		||||
def on_connect(client, userdata, rc, *extra_params):
 | 
			
		||||
   print('Connected with result code '+str(rc))
 | 
			
		||||
   # Subscribing in on_connect() means that if we lose the connection and
 | 
			
		||||
   # reconnect then subscriptions will be renewed.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user