This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # mosquitto This shell script takes care of starting and stopping | |
| # mosquitto (MQTT 3.1 broker) on Amazon Linux. | |
| # | |
| # chkconfig: - 58 74 | |
| # description: mosquitto is a MQTT 3.1 broker. \ | |
| # http://mosquitto.org/ | |
| ### BEGIN INIT INFO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import paho.mqtt.client as mqtt | |
| # The callback for when the client receives a CONNACK response from the server. | |
| def on_connect(client, userdata, rc): | |
| print("Connected with result code "+str(rc)) | |
| # Subscribing in on_connect() means that if we lose the connection and | |
| # reconnect then subscriptions will be renewed. | |
| client.subscribe("hello/world") | |
| # The callback for when a PUBLISH message is received from the server. |
NewerOlder