title: socket error when connecting paho.mqtt.python to mosquitto broker
body: <p>I'm trying to connect from python script(paho.mqtt.python) to mosquitto broker.
  I can connect from terminal using this command:</p>
  
  <pre><code>mosquitto_sub -h localhost -p 8883 -v -t 'owntracks/#' -u owntracks -P 12qwaszx
  </code></pre>
  
  <p>But when I'm trying to connect via python script I'm getting the error:</p>
  
  <pre><code>Socket error on client &lt;unknown&gt;, disconnecting.
  </code></pre>
  
  <p>The script I'm using is the example:
  (from here: <a href="https://owntracks.org/booklet/tech/program/" rel="nofollow noreferrer">https://owntracks.org/booklet/tech/program/</a>)</p>
  
  <pre><code>import paho.mqtt.client as mqtt
  import json
  
  # The callback for when the client successfully connects to the broker
  def on_connect(client, userdata, rc):
      ''' We subscribe on_connect() so that if we lose the connection
          and reconnect, subscriptions will be renewed. '''
  
      client.subscribe("owntracks/+/+")
      #tried also: client.subscribe("owntracks/#")
  # The callback for when a PUBLISH message is received from the broker
  def on_message(client, userdata, msg):
  
      topic = msg.topic
  
      try:
          data = json.loads(str(msg.payload))
  
          print "TID = {0} is currently at {1}, {2}".format(data['tid'], data['lat'], data['lon'])
      except:
          print "Cannot decode data on topic {0}".format(topic)
  
  client = mqtt.Client()
  client.on_connect = on_connect
  client.on_message = on_message
  
  client.connect("localhost", 8883, 60)
  
  # Blocking call which processes all network traffic and dispatches
  # callbacks (see on_*() above). It also handles reconnecting.
  
  client.loop_forever()
  </code></pre>
  
  <p>Here is the content of my config file (I changed the "localhost" from my real IP - tried both of them): </p>
  
  <pre><code># Place your local configuration in /etc/mosquitto/conf.d/
  #
  # A full description of the configuration file is at
  # /usr/share/doc/mosquitto/examples/mosquitto.conf.example
  
  pid_file /var/run/mosquitto.pid
  log_dest file /var/log/mosquitto/mosquitto.log
  include_dir /etc/mosquitto/conf.d
  listener 8883 "localhost"
  persistence true
  persistence_location /var/lib/mosquitto/
  persistence_file mosquitto.db
  log_dest syslog
  log_dest stdout
  log_dest topic
  log_type error
  log_type warning
  log_type notice
  log_type information
  connection_messages true
  log_timestamp true
  allow_anonymous false
  password_file /etc/mosquitto/pwfile
  </code></pre>
  
  <p>Any help would be highly appreciated.</p>