2024-03-26 05:13:12 +00:00
|
|
|
import sdtcloudpubsub
|
|
|
|
import time
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
sdtcloud = sdtcloudpubsub.sdtcloudpubsub()
|
|
|
|
mqttClient = sdtcloud.setClient(f"device-app-{uuid.uuid1()}") # parameter is client ID(string)
|
|
|
|
|
|
|
|
def runAction():
|
|
|
|
while True:
|
|
|
|
msg = {
|
2024-03-26 05:21:01 +00:00
|
|
|
"messages": "Hello World"
|
2024-03-26 05:13:12 +00:00
|
|
|
}
|
|
|
|
sdtcloud.pubMessage(mqttClient, msg)
|
|
|
|
time.sleep(2)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
runAction()
|
|
|
|
|