myqtt — PyMyQtt base module: base functions (create listeners, register handlers)

This modules includes all functions required to establish a MQTT session, create MQTT listeners

This module also includes type definition for the following classes:

Module API

myqtt.create_listener(ctx, host, port)

Allows to create a MQTT listener to receiving incoming connections. Here is an example:

# create a listener
listener = myqtt.create_listener (ctx, "", "1883")

# check listener started
if not listener.is_ok ():
    # do some error handling
    sys.exit (-1)

# do a wait operation
myqtt.wait_listeners (ctx, unlock_on_signal=True)
  • ctx (myqtt.Ctx) – myqtt context where the listener will be created
  • host (String) – the hostname
  • port (String) – the port to connect to
Return type:

myqtt.Connection representing the listener created.

myqtt.wait_listeners(ctx[, unlock_on_signal])

Allows to perform a wait operation until myqtt context is finished or due to a signal received.

  • ctx (myqtt.Ctx) – context where a listener or a set of listener were created.
  • unlock_on_signal (Integer: True or False) – unlock_on_signal expects to receive True to make wait_listener to unlock on signal received.

Allows to unlock the thread that is blocked at wait_listeners call

Parameters:ctx (myqtt.Ctx) – context where a listener or a set of listener were created.

Table Of Contents

Previous topic

PyMyqtt manual

Next topic

myqtt.Ctx — PyMyQttCtx class: context handling

This Page