Skip to main content
## Python Client for MQTT-SN brokers

### Usage examples

```python
from mqttsn.client import Client, Callback

import sys


class MyCallback(Callback):
def message_arrived(self, topic_name, payload, qos, retained, msgid):
print(f'{self} | topic_name: {topic_name} | payload: {payload} | '
f'qos {qos} | retained {retained} | msgid {msgid}',
file=sys.stderr)

return True


if __name__ == '__main__':
aclient = Client("linh", port=1883)
aclient.register_callback(MyCallback())
aclient.connect()

rc, topic1 = aclient.subscribe("topic1")
print("topic id for topic1 is", topic1)

rc, topic2 = aclient.subscribe("topic2")
print("topic id for topic2 is", topic2)

aclient.publish(topic1, "aaaa", qos=0)
aclient.publish(topic2, "bbbb", qos=0)

aclient.unsubscribe("topic1")

aclient.publish(topic2, "cccc", qos=0)
aclient.publish(topic1, "dddd", qos=0)

aclient.disconnect()
```


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mqttsn-0.0.4.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mqttsn-0.0.4-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file mqttsn-0.0.4.tar.gz.

File metadata

  • Download URL: mqttsn-0.0.4.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mqttsn-0.0.4.tar.gz
Algorithm Hash digest
SHA256 12ebc472e997c8a31884fb106860d7081178c989a6579f8b3e48e247adee9243
MD5 868b19ab44d159aad048ab2e69074ed4
BLAKE2b-256 c50289353c7619ed72f796f29885457a3c6617541bfb416ebf685a630e3be623

See more details on using hashes here.

File details

Details for the file mqttsn-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for mqttsn-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8ca2153aee514511e28ee3f663b42eb90e4b424914a8b1a4d1e31d1a4ea1ab5d
MD5 f5b1de125c205ce2fc6d1ca518fe8795
BLAKE2b-256 0dcb3c18a984a13253e2a6c6f859d92e970bea133baa825a8def77782683fd56

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page