Help on module paho.mqtt.client in paho.mqtt:

NAME
    paho.mqtt.client

DESCRIPTION
    # Copyright (c) 2012-2019 Roger Light and others
    #
    # All rights reserved. This program and the accompanying materials
    # are made available under the terms of the Eclipse Public License v2.0
    # and Eclipse Distribution License v1.0 which accompany this distribution.
    #
    # The Eclipse Public License is available at
    #    http://www.eclipse.org/legal/epl-v10.html
    # and the Eclipse Distribution License is available at
    #   http://www.eclipse.org/org/documents/edl-v10.php.
    #
    # Contributors:
    #    Roger Light - initial API and implementation
    #    Ian Craggs - MQTT V5 support

CLASSES
    builtins.ValueError(builtins.Exception)
        WebsocketConnectionError
    builtins.object
        Client
        MQTTMessage
        MQTTMessageInfo
        WebsocketWrapper
    
    class Client(builtins.object)
     |  Client(client_id='', clean_session=None, userdata=None, protocol=4, transport='tcp', reconnect_on_failure=True)
     |  
     |  MQTT version 3.1/3.1.1/5.0 client class.
     |  
     |  This is the main class for use communicating with an MQTT broker.
     |  
     |  General usage flow:
     |  
     |  * Use connect()/connect_async() to connect to a broker
     |  * Call loop() frequently to maintain network traffic flow with the broker
     |  * Or use loop_start() to set a thread running to call loop() for you.
     |  * Or use loop_forever() to handle calling loop() for you in a blocking
     |  * function.
     |  * Use subscribe() to subscribe to a topic and receive messages
     |  * Use publish() to send messages
     |  * Use disconnect() to disconnect from the broker
     |  
     |  Data returned from the broker is made available with the use of callback
     |  functions as described below.
     |  
     |  Callbacks
     |  =========
     |  
     |  A number of callback functions are available to receive data back from the
     |  broker. To use a callback, define a function and then assign it to the
     |  client:
     |  
     |  def on_connect(client, userdata, flags, rc):
     |      print("Connection returned " + str(rc))
     |  
     |  client.on_connect = on_connect
     |  
     |  Callbacks can also be attached using decorators:
     |  
     |  client = paho.mqtt.Client()
     |  
     |  @client.connect_callback()
     |  def on_connect(client, userdata, flags, rc):
     |      print("Connection returned " + str(rc))
     |  
     |  
     |  **IMPORTANT** the required function signature for a callback can differ
     |  depending on whether you are using MQTT v5 or MQTT v3.1.1/v3.1. See the
     |  documentation for each callback.
     |  
     |  All of the callbacks as described below have a "client" and an "userdata"
     |  argument. "client" is the Client instance that is calling the callback.
     |  "userdata" is user data of any type and can be set when creating a new client
     |  instance or with user_data_set(userdata).
     |  
     |  If you wish to suppress exceptions within a callback, you should set
     |  `client.suppress_exceptions = True`
     |  
     |  The callbacks are listed below, documentation for each of them can be found
     |  at the same function name:
     |  
     |  on_connect, on_connect_fail, on_disconnect, on_message, on_publish,
     |  on_subscribe, on_unsubscribe, on_log, on_socket_open, on_socket_close,
     |  on_socket_register_write, on_socket_unregister_write
     |  
     |  Methods defined here:
     |  
     |  __del__(self)
     |  
     |  __init__(self, client_id='', clean_session=None, userdata=None, protocol=4, transport='tcp', reconnect_on_failure=True)
     |      client_id is the unique client id string used when connecting to the
     |      broker. If client_id is zero length or None, then the behaviour is
     |      defined by which protocol version is in use. If using MQTT v3.1.1, then
     |      a zero length client id will be sent to the broker and the broker will
     |      generate a random for the client. If using MQTT v3.1 then an id will be
     |      randomly generated. In both cases, clean_session must be True. If this
     |      is not the case a ValueError will be raised.
     |      
     |      clean_session is a boolean that determines the client type. If True,
     |      the broker will remove all information about this client when it
     |      disconnects. If False, the client is a persistent client and
     |      subscription information and queued messages will be retained when the
     |      client disconnects.
     |      Note that a client will never discard its own outgoing messages on
     |      disconnect. Calling connect() or reconnect() will cause the messages to
     |      be resent.  Use reinitialise() to reset a client to its original state.
     |      The clean_session argument only applies to MQTT versions v3.1.1 and v3.1.
     |      It is not accepted if the MQTT version is v5.0 - use the clean_start
     |      argument on connect() instead.
     |      
     |      userdata is user defined data of any type that is passed as the "userdata"
     |      parameter to callbacks. It may be updated at a later point with the
     |      user_data_set() function.
     |      
     |      The protocol argument allows explicit setting of the MQTT version to
     |      use for this client. Can be paho.mqtt.client.MQTTv311 (v3.1.1),
     |      paho.mqtt.client.MQTTv31 (v3.1) or paho.mqtt.client.MQTTv5 (v5.0),
     |      with the default being v3.1.1.
     |      
     |      Set transport to "websockets" to use WebSockets as the transport
     |      mechanism. Set to "tcp" to use raw TCP, which is the default.
     |  
     |  connect(self, host, port=1883, keepalive=60, bind_address='', bind_port=0, clean_start=3, properties=None)
     |      Connect to a remote broker.
     |      
     |      host is the hostname or IP address of the remote broker.
     |      port is the network port of the server host to connect to. Defaults to
     |      1883. Note that the default port for MQTT over SSL/TLS is 8883 so if you
     |      are using tls_set() the port may need providing.
     |      keepalive: Maximum period in seconds between communications with the
     |      broker. If no other messages are being exchanged, this controls the
     |      rate at which the client will send ping messages to the broker.
     |      clean_start: (MQTT v5.0 only) True, False or MQTT_CLEAN_START_FIRST_ONLY.
     |      Sets the MQTT v5.0 clean_start flag always, never or on the first successful connect only,
     |      respectively.  MQTT session data (such as outstanding messages and subscriptions)
     |      is cleared on successful connect when the clean_start flag is set.
     |      properties: (MQTT v5.0 only) the MQTT v5.0 properties to be sent in the
     |      MQTT connect packet.
     |  
     |  connect_async(self, host, port=1883, keepalive=60, bind_address='', bind_port=0, clean_start=3, properties=None)
     |      Connect to a remote broker asynchronously. This is a non-blocking
     |      connect call that can be used with loop_start() to provide very quick
     |      start.
     |      
     |      host is the hostname or IP address of the remote broker.
     |      port is the network port of the server host to connect to. Defaults to
     |      1883. Note that the default port for MQTT over SSL/TLS is 8883 so if you
     |      are using tls_set() the port may need providing.
     |      keepalive: Maximum period in seconds between communications with the
     |      broker. If no other messages are being exchanged, this controls the
     |      rate at which the client will send ping messages to the broker.
     |      clean_start: (MQTT v5.0 only) True, False or MQTT_CLEAN_START_FIRST_ONLY.
     |      Sets the MQTT v5.0 clean_start flag always, never or on the first successful connect only,
     |      respectively.  MQTT session data (such as outstanding messages and subscriptions)
     |      is cleared on successful connect when the clean_start flag is set.
     |      properties: (MQTT v5.0 only) the MQTT v5.0 properties to be sent in the
     |      MQTT connect packet.  Use the Properties class.
     |  
     |  connect_callback(self)
     |  
     |  connect_fail_callback(self)
     |  
     |  connect_srv(self, domain=None, keepalive=60, bind_address='', clean_start=3, properties=None)
     |      Connect to a remote broker.
     |      
     |      domain is the DNS domain to search for SRV records; if None,
     |      try to determine local domain name.
     |      keepalive, bind_address, clean_start and properties are as for connect()
     |  
     |  disable_logger(self)
     |  
     |  disconnect(self, reasoncode=None, properties=None)
     |      Disconnect a connected client from the broker.
     |      reasoncode: (MQTT v5.0 only) a ReasonCodes instance setting the MQTT v5.0
     |      reasoncode to be sent with the disconnect.  It is optional, the receiver
     |      then assuming that 0 (success) is the value.
     |      properties: (MQTT v5.0 only) a Properties instance setting the MQTT v5.0 properties
     |      to be included. Optional - if not set, no properties are sent.
     |  
     |  disconnect_callback(self)
     |  
     |  enable_bridge_mode(self)
     |      Sets the client in a bridge mode instead of client mode.
     |      
     |      Must be called before connect() to have any effect.
     |      Requires brokers that support bridge mode.
     |      
     |      Under bridge mode, the broker will identify the client as a bridge and
     |      not send it's own messages back to it. Hence a subsciption of # is
     |      possible without message loops. This feature also correctly propagates
     |      the retain flag on the messages.
     |      
     |      Currently Mosquitto and RSMB support this feature. This feature can
     |      be used to create a bridge between multiple broker.
     |  
     |  enable_logger(self, logger=None)
     |      Enables a logger to send log messages to
     |  
     |  is_connected(self)
     |      Returns the current status of the connection
     |      
     |      True if connection exists
     |      False if connection is closed
     |  
     |  log_callback(self)
     |  
     |  loop(self, timeout=1.0, max_packets=1)
     |      Process network events.
     |      
     |      It is strongly recommended that you use loop_start(), or
     |      loop_forever(), or if you are using an external event loop using
     |      loop_read(), loop_write(), and loop_misc(). Using loop() on it's own is
     |      no longer recommended.
     |      
     |      This function must be called regularly to ensure communication with the
     |      broker is carried out. It calls select() on the network socket to wait
     |      for network events. If incoming data is present it will then be
     |      processed. Outgoing commands, from e.g. publish(), are normally sent
     |      immediately that their function is called, but this is not always
     |      possible. loop() will also attempt to send any remaining outgoing
     |      messages, which also includes commands that are part of the flow for
     |      messages with QoS>0.
     |      
     |      timeout: The time in seconds to wait for incoming/outgoing network
     |          traffic before timing out and returning.
     |      max_packets: Not currently used.
     |      
     |      Returns MQTT_ERR_SUCCESS on success.
     |      Returns >0 on error.
     |      
     |      A ValueError will be raised if timeout < 0
     |  
     |  loop_forever(self, timeout=1.0, max_packets=1, retry_first_connection=False)
     |      This function calls the network loop functions for you in an
     |      infinite blocking loop. It is useful for the case where you only want
     |      to run the MQTT client loop in your program.
     |      
     |      loop_forever() will handle reconnecting for you if reconnect_on_failure is
     |      true (this is the default behavior). If you call disconnect() in a callback
     |      it will return.
     |      
     |      
     |      timeout: The time in seconds to wait for incoming/outgoing network
     |        traffic before timing out and returning.
     |      max_packets: Not currently used.
     |      retry_first_connection: Should the first connection attempt be retried on failure.
     |        This is independent of the reconnect_on_failure setting.
     |      
     |      Raises OSError/WebsocketConnectionError on first connection failures unless retry_first_connection=True
     |  
     |  loop_misc(self)
     |      Process miscellaneous network events. Use in place of calling loop() if you
     |      wish to call select() or equivalent on.
     |      
     |      Do not use if you are using the threaded interface loop_start().
     |  
     |  loop_read(self, max_packets=1)
     |      Process read network events. Use in place of calling loop() if you
     |      wish to handle your client reads as part of your own application.
     |      
     |      Use socket() to obtain the client socket to call select() or equivalent
     |      on.
     |      
     |      Do not use if you are using the threaded interface loop_start().
     |  
     |  loop_start(self)
     |      This is part of the threaded client interface. Call this once to
     |      start a new thread to process network traffic. This provides an
     |      alternative to repeatedly calling loop() yourself.
     |  
     |  loop_stop(self, force=False)
     |      This is part of the threaded client interface. Call this once to
     |      stop the network thread previously created with loop_start(). This call
     |      will block until the network thread finishes.
     |      
     |      The force parameter is currently ignored.
     |  
     |  loop_write(self, max_packets=1)
     |      Process write network events. Use in place of calling loop() if you
     |      wish to handle your client writes as part of your own application.
     |      
     |      Use socket() to obtain the client socket to call select() or equivalent
     |      on.
     |      
     |      Use want_write() to determine if there is data waiting to be written.
     |      
     |      Do not use if you are using the threaded interface loop_start().
     |  
     |  max_inflight_messages_set(self, inflight)
     |      Set the maximum number of messages with QoS>0 that can be part way
     |      through their network flow at once. Defaults to 20.
     |  
     |  max_queued_messages_set(self, queue_size)
     |      Set the maximum number of messages in the outgoing message queue.
     |      0 means unlimited.
     |  
     |  message_callback(self)
     |  
     |  message_callback_add(self, sub, callback)
     |      Register a message callback for a specific topic.
     |      Messages that match 'sub' will be passed to 'callback'. Any
     |      non-matching messages will be passed to the default on_message
     |      callback.
     |      
     |      Call multiple times with different 'sub' to define multiple topic
     |      specific callbacks.
     |      
     |      Topic specific callbacks may be removed with
     |      message_callback_remove().
     |  
     |  message_callback_remove(self, sub)
     |      Remove a message callback previously registered with
     |      message_callback_add().
     |  
     |  message_retry_set(self, retry)
     |      No longer used, remove in version 2.0
     |  
     |  proxy_set(self, **proxy_args)
     |      Configure proxying of MQTT connection. Enables support for SOCKS or
     |      HTTP proxies.
     |      
     |      Proxying is done through the PySocks library. Brief descriptions of the
     |      proxy_args parameters are below; see the PySocks docs for more info.
     |      
     |      (Required)
     |      proxy_type: One of {socks.HTTP, socks.SOCKS4, or socks.SOCKS5}
     |      proxy_addr: IP address or DNS name of proxy server
     |      
     |      (Optional)
     |      proxy_rdns: boolean indicating whether proxy lookup should be performed
     |          remotely (True, default) or locally (False)
     |      proxy_username: username for SOCKS5 proxy, or userid for SOCKS4 proxy
     |      proxy_password: password for SOCKS5 proxy
     |      
     |      Must be called before connect() or connect_async().
     |  
     |  publish(self, topic, payload=None, qos=0, retain=False, properties=None)
     |      Publish a message on a topic.
     |      
     |      This causes a message to be sent to the broker and subsequently from
     |      the broker to any clients subscribing to matching topics.
     |      
     |      topic: The topic that the message should be published on.
     |      payload: The actual message to send. If not given, or set to None a
     |      zero length message will be used. Passing an int or float will result
     |      in the payload being converted to a string representing that number. If
     |      you wish to send a true int/float, use struct.pack() to create the
     |      payload you require.
     |      qos: The quality of service level to use.
     |      retain: If set to true, the message will be set as the "last known
     |      good"/retained message for the topic.
     |      properties: (MQTT v5.0 only) the MQTT v5.0 properties to be included.
     |      Use the Properties class.
     |      
     |      Returns a MQTTMessageInfo class, which can be used to determine whether
     |      the message has been delivered (using info.is_published()) or to block
     |      waiting for the message to be delivered (info.wait_for_publish()). The
     |      message ID and return code of the publish() call can be found at
     |      info.mid and info.rc.
     |      
     |      For backwards compatibility, the MQTTMessageInfo class is iterable so
     |      the old construct of (rc, mid) = client.publish(...) is still valid.
     |      
     |      rc is MQTT_ERR_SUCCESS to indicate success or MQTT_ERR_NO_CONN if the
     |      client is not currently connected.  mid is the message ID for the
     |      publish request. The mid value can be used to track the publish request
     |      by checking against the mid argument in the on_publish() callback if it
     |      is defined.
     |      
     |      A ValueError will be raised if topic is None, has zero length or is
     |      invalid (contains a wildcard), except if the MQTT version used is v5.0.
     |      For v5.0, a zero length topic can be used when a Topic Alias has been set.
     |      
     |      A ValueError will be raised if qos is not one of 0, 1 or 2, or if
     |      the length of the payload is greater than 268435455 bytes.
     |  
     |  publish_callback(self)
     |  
     |  reconnect(self)
     |      Reconnect the client after a disconnect. Can only be called after
     |      connect()/connect_async().
     |  
     |  reconnect_delay_set(self, min_delay=1, max_delay=120)
     |      Configure the exponential reconnect delay
     |      
     |      When connection is lost, wait initially min_delay seconds and
     |      double this time every attempt. The wait is capped at max_delay.
     |      Once the client is fully connected (e.g. not only TCP socket, but
     |      received a success CONNACK), the wait timer is reset to min_delay.
     |  
     |  reinitialise(self, client_id='', clean_session=True, userdata=None)
     |  
     |  socket(self)
     |      Return the socket or ssl object for this client.
     |  
     |  socket_close_callback(self)
     |  
     |  socket_open_callback(self)
     |  
     |  socket_register_write_callback(self)
     |  
     |  socket_unregister_write_callback(self)
     |  
     |  subscribe(self, topic, qos=0, options=None, properties=None)
     |      Subscribe the client to one or more topics.
     |      
     |      This function may be called in three different ways (and a further three for MQTT v5.0):
     |      
     |      Simple string and integer
     |      -------------------------
     |      e.g. subscribe("my/topic", 2)
     |      
     |      topic: A string specifying the subscription topic to subscribe to.
     |      qos: The desired quality of service level for the subscription.
     |           Defaults to 0.
     |      options and properties: Not used.
     |      
     |      Simple string and subscribe options (MQTT v5.0 only)
     |      ----------------------------------------------------
     |      e.g. subscribe("my/topic", options=SubscribeOptions(qos=2))
     |      
     |      topic: A string specifying the subscription topic to subscribe to.
     |      qos: Not used.
     |      options: The MQTT v5.0 subscribe options.
     |      properties: a Properties instance setting the MQTT v5.0 properties
     |      to be included. Optional - if not set, no properties are sent.
     |      
     |      String and integer tuple
     |      ------------------------
     |      e.g. subscribe(("my/topic", 1))
     |      
     |      topic: A tuple of (topic, qos). Both topic and qos must be present in
     |             the tuple.
     |      qos and options: Not used.
     |      properties: Only used for MQTT v5.0.  A Properties instance setting the
     |      MQTT v5.0 properties. Optional - if not set, no properties are sent.
     |      
     |      String and subscribe options tuple (MQTT v5.0 only)
     |      ---------------------------------------------------
     |      e.g. subscribe(("my/topic", SubscribeOptions(qos=1)))
     |      
     |      topic: A tuple of (topic, SubscribeOptions). Both topic and subscribe
     |              options must be present in the tuple.
     |      qos and options: Not used.
     |      properties: a Properties instance setting the MQTT v5.0 properties
     |      to be included. Optional - if not set, no properties are sent.
     |      
     |      List of string and integer tuples
     |      ---------------------------------
     |      e.g. subscribe([("my/topic", 0), ("another/topic", 2)])
     |      
     |      This allows multiple topic subscriptions in a single SUBSCRIPTION
     |      command, which is more efficient than using multiple calls to
     |      subscribe().
     |      
     |      topic: A list of tuple of format (topic, qos). Both topic and qos must
     |             be present in all of the tuples.
     |      qos, options and properties: Not used.
     |      
     |      List of string and subscribe option tuples (MQTT v5.0 only)
     |      -----------------------------------------------------------
     |      e.g. subscribe([("my/topic", SubscribeOptions(qos=0), ("another/topic", SubscribeOptions(qos=2)])
     |      
     |      This allows multiple topic subscriptions in a single SUBSCRIPTION
     |      command, which is more efficient than using multiple calls to
     |      subscribe().
     |      
     |      topic: A list of tuple of format (topic, SubscribeOptions). Both topic and subscribe
     |              options must be present in all of the tuples.
     |      qos and options: Not used.
     |      properties: a Properties instance setting the MQTT v5.0 properties
     |      to be included. Optional - if not set, no properties are sent.
     |      
     |      The function returns a tuple (result, mid), where result is
     |      MQTT_ERR_SUCCESS to indicate success or (MQTT_ERR_NO_CONN, None) if the
     |      client is not currently connected.  mid is the message ID for the
     |      subscribe request. The mid value can be used to track the subscribe
     |      request by checking against the mid argument in the on_subscribe()
     |      callback if it is defined.
     |      
     |      Raises a ValueError if qos is not 0, 1 or 2, or if topic is None or has
     |      zero string length, or if topic is not a string, tuple or list.
     |  
     |  subscribe_callback(self)
     |  
     |  tls_insecure_set(self, value)
     |      Configure verification of the server hostname in the server certificate.
     |      
     |      If value is set to true, it is impossible to guarantee that the host
     |      you are connecting to is not impersonating your server. This can be
     |      useful in initial server testing, but makes it possible for a malicious
     |      third party to impersonate your server through DNS spoofing, for
     |      example.
     |      
     |      Do not use this function in a real system. Setting value to true means
     |      there is no point using encryption.
     |      
     |      Must be called before connect() and after either tls_set() or
     |      tls_set_context().
     |  
     |  tls_set(self, ca_certs=None, certfile=None, keyfile=None, cert_reqs=None, tls_version=None, ciphers=None, keyfile_password=None)
     |      Configure network encryption and authentication options. Enables SSL/TLS support.
     |      
     |      ca_certs : a string path to the Certificate Authority certificate files
     |      that are to be treated as trusted by this client. If this is the only
     |      option given then the client will operate in a similar manner to a web
     |      browser. That is to say it will require the broker to have a
     |      certificate signed by the Certificate Authorities in ca_certs and will
     |      communicate using TLS v1,2, but will not attempt any form of
     |      authentication. This provides basic network encryption but may not be
     |      sufficient depending on how the broker is configured.
     |      By default, on Python 2.7.9+ or 3.4+, the default certification
     |      authority of the system is used. On older Python version this parameter
     |      is mandatory.
     |      
     |      certfile and keyfile are strings pointing to the PEM encoded client
     |      certificate and private keys respectively. If these arguments are not
     |      None then they will be used as client information for TLS based
     |      authentication.  Support for this feature is broker dependent. Note
     |      that if either of these files in encrypted and needs a password to
     |      decrypt it, then this can be passed using the keyfile_password
     |      argument - you should take precautions to ensure that your password is
     |      not hard coded into your program by loading the password from a file
     |      for example. If you do not provide keyfile_password, the password will
     |      be requested to be typed in at a terminal window.
     |      
     |      cert_reqs allows the certificate requirements that the client imposes
     |      on the broker to be changed. By default this is ssl.CERT_REQUIRED,
     |      which means that the broker must provide a certificate. See the ssl
     |      pydoc for more information on this parameter.
     |      
     |      tls_version allows the version of the SSL/TLS protocol used to be
     |      specified. By default TLS v1.2 is used. Previous versions are allowed
     |      but not recommended due to possible security problems.
     |      
     |      ciphers is a string specifying which encryption ciphers are allowable
     |      for this connection, or None to use the defaults. See the ssl pydoc for
     |      more information.
     |      
     |      Must be called before connect() or connect_async().
     |  
     |  tls_set_context(self, context=None)
     |      Configure network encryption and authentication context. Enables SSL/TLS support.
     |      
     |      context : an ssl.SSLContext object. By default this is given by
     |      `ssl.create_default_context()`, if available.
     |      
     |      Must be called before connect() or connect_async().
     |  
     |  topic_callback(self, sub)
     |  
     |  unsubscribe(self, topic, properties=None)
     |      Unsubscribe the client from one or more topics.
     |      
     |      topic: A single string, or list of strings that are the subscription
     |             topics to unsubscribe from.
     |      properties: (MQTT v5.0 only) a Properties instance setting the MQTT v5.0 properties
     |      to be included. Optional - if not set, no properties are sent.
     |      
     |      Returns a tuple (result, mid), where result is MQTT_ERR_SUCCESS
     |      to indicate success or (MQTT_ERR_NO_CONN, None) if the client is not
     |      currently connected.
     |      mid is the message ID for the unsubscribe request. The mid value can be
     |      used to track the unsubscribe request by checking against the mid
     |      argument in the on_unsubscribe() callback if it is defined.
     |      
     |      Raises a ValueError if topic is None or has zero string length, or is
     |      not a string or list.
     |  
     |  unsubscribe_callback(self)
     |  
     |  user_data_set(self, userdata)
     |      Set the user data variable passed to callbacks. May be any data type.
     |  
     |  username_pw_set(self, username, password=None)
     |      Set a username and optionally a password for broker authentication.
     |      
     |      Must be called before connect() to have any effect.
     |      Requires a broker that supports MQTT v3.1.
     |      
     |      username: The username to authenticate with. Need have no relationship to the client id. Must be unicode
     |          [MQTT-3.1.3-11].
     |          Set to None to reset client back to not using username/password for broker authentication.
     |      password: The password to authenticate with. Optional, set to None if not required. If it is unicode, then it
     |          will be encoded as UTF-8.
     |  
     |  want_write(self)
     |      Call to determine if there is network data waiting to be written.
     |      Useful if you are calling select() yourself rather than using loop().
     |  
     |  will_clear(self)
     |      Removes a will that was previously configured with will_set().
     |      
     |      Must be called before connect() to have any effect.
     |  
     |  will_set(self, topic, payload=None, qos=0, retain=False, properties=None)
     |      Set a Will to be sent by the broker in case the client disconnects unexpectedly.
     |      
     |      This must be called before connect() to have any effect.
     |      
     |      topic: The topic that the will message should be published on.
     |      payload: The message to send as a will. If not given, or set to None a
     |      zero length message will be used as the will. Passing an int or float
     |      will result in the payload being converted to a string representing
     |      that number. If you wish to send a true int/float, use struct.pack() to
     |      create the payload you require.
     |      qos: The quality of service level to use for the will.
     |      retain: If set to true, the will message will be set as the "last known
     |      good"/retained message for the topic.
     |      properties: (MQTT v5.0 only) a Properties instance setting the MQTT v5.0 properties
     |      to be included with the will message. Optional - if not set, no properties are sent.
     |      
     |      Raises a ValueError if qos is not 0, 1 or 2, or if topic is None or has
     |      zero string length.
     |  
     |  ws_set_options(self, path='/mqtt', headers=None)
     |      Set the path and headers for a websocket connection
     |      
     |      path is a string starting with / which should be the endpoint of the
     |      mqtt connection on the remote server
     |      
     |      headers can be either a dict or a callable object. If it is a dict then
     |      the extra items in the dict are added to the websocket headers. If it is
     |      a callable, then the default websocket headers are passed into this
     |      function and the result is used as the new headers.
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  on_connect
     |      If implemented, called when the broker responds to our connection
     |      request.
     |  
     |  on_connect_fail
     |      If implemented, called when the client failed to connect
     |      to the broker.
     |  
     |  on_disconnect
     |      If implemented, called when the client disconnects from the broker.
     |  
     |  on_log
     |      If implemented, called when the client has log information.
     |      Defined to allow debugging.
     |  
     |  on_message
     |      If implemented, called when a message has been received on a topic
     |      that the client subscribes to.
     |      
     |      This callback will be called for every message received. Use
     |      message_callback_add() to define multiple callbacks that will be called
     |      for specific topic filters.
     |  
     |  on_publish
     |      If implemented, called when a message that was to be sent using the
     |      publish() call has completed transmission to the broker.
     |      
     |      For messages with QoS levels 1 and 2, this means that the appropriate
     |      handshakes have completed. For QoS 0, this simply means that the message
     |      has left the client.
     |      This callback is important because even if the publish() call returns
     |      success, it does not always mean that the message has been sent.
     |  
     |  on_socket_close
     |      If implemented, called just before the socket is closed.
     |  
     |  on_socket_open
     |      If implemented, called just after the socket was opend.
     |  
     |  on_socket_register_write
     |      If implemented, called when the socket needs writing but can't.
     |  
     |  on_socket_unregister_write
     |      If implemented, called when the socket doesn't need writing anymore.
     |  
     |  on_subscribe
     |      If implemented, called when the broker responds to a subscribe
     |      request.
     |  
     |  on_unsubscribe
     |      If implemented, called when the broker responds to an unsubscribe
     |      request.
    
    class MQTTMessage(builtins.object)
     |  MQTTMessage(mid=0, topic=b'')
     |  
     |  This is a class that describes an incoming or outgoing message. It is
     |  passed to the on_message callback as the message parameter.
     |  
     |  Members:
     |  
     |  topic : String. topic that the message was published on.
     |  payload : Bytes/Byte array. the message payload.
     |  qos : Integer. The message Quality of Service 0, 1 or 2.
     |  retain : Boolean. If true, the message is a retained message and not fresh.
     |  mid : Integer. The message id.
     |  properties: Properties class. In MQTT v5.0, the properties associated with the message.
     |  
     |  Methods defined here:
     |  
     |  __eq__(self, other)
     |      Override the default Equals behavior
     |  
     |  __init__(self, mid=0, topic=b'')
     |      Initialize self.  See help(type(self)) for accurate signature.
     |  
     |  __ne__(self, other)
     |      Define a non-equality test
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  dup
     |  
     |  info
     |  
     |  mid
     |  
     |  payload
     |  
     |  properties
     |  
     |  qos
     |  
     |  retain
     |  
     |  state
     |  
     |  timestamp
     |  
     |  topic
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __hash__ = None
    
    class MQTTMessageInfo(builtins.object)
     |  MQTTMessageInfo(mid)
     |  
     |  This is a class returned from Client.publish() and can be used to find
     |  out the mid of the message that was published, and to determine whether the
     |  message has been published, and/or wait until it is published.
     |  
     |  Methods defined here:
     |  
     |  __getitem__(self, index)
     |  
     |  __init__(self, mid)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |  
     |  __iter__(self)
     |  
     |  __next__(self)
     |  
     |  __str__(self)
     |      Return str(self).
     |  
     |  is_published(self)
     |      Returns True if the message associated with this object has been
     |      published, else returns False.
     |  
     |  next(self)
     |  
     |  wait_for_publish(self, timeout=None)
     |      Block until the message associated with this object is published, or
     |      until the timeout occurs. If timeout is None, this will never time out.
     |      Set timeout to a positive number of seconds, e.g. 1.2, to enable the
     |      timeout.
     |      
     |      Raises ValueError if the message was not queued due to the outgoing
     |      queue being full.
     |      
     |      Raises RuntimeError if the message was not published for another
     |      reason.
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  mid
     |  
     |  rc
    
    class WebsocketConnectionError(builtins.ValueError)
     |  Inappropriate argument value (of correct type).
     |  
     |  Method resolution order:
     |      WebsocketConnectionError
     |      builtins.ValueError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |  
     |  Data descriptors defined here:
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.ValueError:
     |  
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |  
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.ValueError:
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |  
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |  
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |  
     |  __reduce__(...)
     |      Helper for pickle.
     |  
     |  __repr__(self, /)
     |      Return repr(self).
     |  
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |  
     |  __setstate__(...)
     |  
     |  __str__(self, /)
     |      Return str(self).
     |  
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |  
     |  __cause__
     |      exception cause
     |  
     |  __context__
     |      exception context
     |  
     |  __dict__
     |  
     |  __suppress_context__
     |  
     |  __traceback__
     |  
     |  args
    
    class WebsocketWrapper(builtins.object)
     |  WebsocketWrapper(socket, host, port, is_ssl, path, extra_headers)
     |  
     |  Methods defined here:
     |  
     |  __del__(self)
     |  
     |  __init__(self, socket, host, port, is_ssl, path, extra_headers)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |  
     |  close(self)
     |  
     |  fileno(self)
     |  
     |  pending(self)
     |  
     |  read(self, length)
     |  
     |  recv(self, length)
     |  
     |  send(self, data)
     |  
     |  setblocking(self, flag)
     |  
     |  write(self, data)
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  OPCODE_BINARY = 2
     |  
     |  OPCODE_CONNCLOSE = 8
     |  
     |  OPCODE_CONTINUATION = 0
     |  
     |  OPCODE_PING = 9
     |  
     |  OPCODE_PONG = 10
     |  
     |  OPCODE_TEXT = 1

FUNCTIONS
    base62(num, base='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', padding=1)
        Convert a number to base-62 representation.
    
    connack_string(connack_code)
        Return the string associated with a CONNACK result.
    
    error_string(mqtt_errno)
        Return the error string associated with an mqtt error number.
    
    time_func = monotonic(...)
        monotonic() -> float
        
        Monotonic clock, cannot go backward.
    
    topic_matches_sub(sub, topic)
        Check whether a topic matches a subscription.
        
        For example:
        
        foo/bar would match the subscription foo/# or +/bar
        non/matching would not match the subscription non/+/+

DATA
    AUTH = 240
    CONNACK = 32
    CONNACK_ACCEPTED = 0
    CONNACK_REFUSED_BAD_USERNAME_PASSWORD = 4
    CONNACK_REFUSED_IDENTIFIER_REJECTED = 2
    CONNACK_REFUSED_NOT_AUTHORIZED = 5
    CONNACK_REFUSED_PROTOCOL_VERSION = 1
    CONNACK_REFUSED_SERVER_UNAVAILABLE = 3
    CONNECT = 16
    DISCONNECT = 224
    EAGAIN = 11
    HAVE_DNS = False
    LOGGING_LEVEL = {1: 20, 2: 20, 4: 30, 8: 40, 16: 10}
    MQTT_BRIDGE = 1
    MQTT_CLEAN_START_FIRST_ONLY = 3
    MQTT_CLIENT = 0
    MQTT_ERR_ACL_DENIED = 12
    MQTT_ERR_AGAIN = -1
    MQTT_ERR_AUTH = 11
    MQTT_ERR_CONN_LOST = 7
    MQTT_ERR_CONN_REFUSED = 5
    MQTT_ERR_ERRNO = 14
    MQTT_ERR_INVAL = 3
    MQTT_ERR_KEEPALIVE = 16
    MQTT_ERR_NOMEM = 1
    MQTT_ERR_NOT_FOUND = 6
    MQTT_ERR_NOT_SUPPORTED = 10
    MQTT_ERR_NO_CONN = 4
    MQTT_ERR_PAYLOAD_SIZE = 9
    MQTT_ERR_PROTOCOL = 2
    MQTT_ERR_QUEUE_SIZE = 15
    MQTT_ERR_SUCCESS = 0
    MQTT_ERR_TLS = 8
    MQTT_ERR_UNKNOWN = 13
    MQTT_LOG_DEBUG = 16
    MQTT_LOG_ERR = 8
    MQTT_LOG_INFO = 1
    MQTT_LOG_NOTICE = 2
    MQTT_LOG_WARNING = 4
    MQTTv31 = 3
    MQTTv311 = 4
    MQTTv5 = 5
    PINGREQ = 192
    PINGRESP = 208
    PUBACK = 64
    PUBCOMP = 112
    PUBLISH = 48
    PUBREC = 80
    PUBREL = 96
    SUBACK = 144
    SUBSCRIBE = 128
    UNSUBACK = 176
    UNSUBSCRIBE = 160
    mqtt_cs_connect_async = 3
    mqtt_cs_connected = 1
    mqtt_cs_disconnecting = 2
    mqtt_cs_new = 0
    mqtt_ms_invalid = 0
    mqtt_ms_publish = 1
    mqtt_ms_queued = 9
    mqtt_ms_resend_pubcomp = 6
    mqtt_ms_resend_pubrel = 4
    mqtt_ms_send_pubrec = 8
    mqtt_ms_wait_for_puback = 2
    mqtt_ms_wait_for_pubcomp = 7
    mqtt_ms_wait_for_pubrec = 3
    mqtt_ms_wait_for_pubrel = 5
    sockpair_data = b'0'
    socks = None

FILE
    /home/ubuntu/miniconda3/envs/blueocean/lib/python3.8/site-packages/paho/mqtt/client.py


