Skip to main content

""" In this code, is developed the library in order to have a communication channel between the broker and the publisher """

""" How to publish?

The only function needed to publish to a topic is the "publish" function. In this function, it is going to be sent a message to a broker in order to be forward to the subscribers.

The function return 1 if the message was sent Else returns 0

PARAMETERS:

topic: is the topic that the client wants to subscribe. This topic has to be separated by slashes ( "/" ) and has to be between 2 and 10 arguments ("toAsset/deviceID/something/something_else")

information: the information is the message or the body that is going to be sent. It has to be a string.

clientID: Client ID is only a way to diferenciate the people that are accessing the information

username: Yet to be implemented

password: Yet to be implemented

WARNING AND ADVICES:

Make sure the information is in double quotes "" and not in single quotes ''

EXAEMPLES:

from mqtt_SSOP import clientPublisher

if name == 'main':

clientPublisher.publish("toAsset/123","Ola tudo bem","IDClient")

"""

""" Errors: 1-> To much arguments 2-> Couldn't split arguments correctly 3-> The input in the main funciton is not a string 4-> Couldn't read the input 5-> To few arguments in the topic """

""" In this code, is developed the library in order to have a communication channel between the broker and the subscriber """

""" How to subscribe?

The only function needed to subscribe to a topic is the "subscribe" function. It recieves the messages from an online broker. The funtion writes in a dict variable

PARAMETERS:

topic: is the topic that the client wants to subscribe. This topic has to be separated by slashes ( "/" ) and has to be betwenn 2 and 10 arguments ("toAsset/deviceID/something/something_else")

information: the information is the message or the body that is going to be recieved. It has to be a dict and in this dict there has to be a "lastMessage" parameter where the message is going to be written on. And everytime the message is recived, it changes the parameter inside the dictionary. If there is no key-value pair with the name "lastMessage", one is created.

clientID: Client ID is only a way to diferenciate the people that are accessing the information

username: Yet to be implemented

password: Yet to be implemented

WARNING AND ADVICES:

This function stop the process, wating for messages. If you want to continuasy recieve messages without stoping the main process, you can create a thread and run in a different process. The dictionary, if pass down to the fucntion, is going to be change even in the main process.

EXAMPLES:

from mqtt_SSOP import clientSubscriber from time import sleep import threading

if name == 'main':

try:
    
    
    message = {
        "lastMessage" : "Not modified",
        "id" : id,
    }

    subThread = threading.Thread(target=lambda : clientSubscriber.subscribe("toAsset/123",message,"something"))
    subThread.start()

    while(1):
        sleep(5)
        print(message)


except KeyboardInterrupt:
    subThread.join()
    print("Processed interrupted! Exiting... ")

"""

""" Errors: 1-> To much arguments 2-> Message to big 3-> Couldn't decode the topic

Metadata

Release files for mqttSSOP 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mqttSSOP 0.1.0
File Size Uploaded Provenance Actions
mqttssop-0.1.0.tar.gz 7.1 MB Without provenance Details for mqttssop-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mqttSSOP 0.1.0
File Interpreter ABI Platform Actions
mqttssop-0.1.0-py3-none-any.whl Python 3 none any Details for mqttssop-0.1.0-py3-none-any.whl

Total release size: 12.7 MB

Release files / mqttssop-0.1.0.tar.gz

Download URL mqttssop-0.1.0.tar.gz
Size 7.1 MB
Tags Source
SHA-256 checksum
How to use checksums
4bf8d9bfdee254060f304cddf4089fc26d0a7f928108908ece81b834fc6a9a5b
BLAKE2b-256 checksum
How to use checksums
b92fa89c35e38ad479bc92207b19b7400e214e9c70bd057551637aacf3d2a822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / mqttssop-0.1.0-py3-none-any.whl

Download URL mqttssop-0.1.0-py3-none-any.whl
Size 5.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
407f12622df8ff89c9a86bfad8b81d9193e7b1188210c5bf02b73760e0ed42c9
BLAKE2b-256 checksum
How to use checksums
c8ab5ed606bad752a885735affba2739806084432b5c626d4340e466a7f2618d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for mqttSSOP 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page