19 lines
395 B
Python
19 lines
395 B
Python
|
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 = {
|
||
|
"message": "Hello World"
|
||
|
}
|
||
|
sdtcloud.pubMessage(mqttClient, msg)
|
||
|
time.sleep(2)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
runAction()
|
||
|
|