Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] python woes

if I use this for the pub, everything works fine:

publish.single("foo/show", "1", )

On Tue, Sep 24, 2019 at 8:06 PM Carl Karsten <carl@xxxxxxxxxxxxxxxx> wrote:



sudo apt install mosquitto
$ mosquitto -h
mosquitto version 1.5.7

shell 1:
mosquitto_sub -v -t \#

shell 2:
import paho.mqtt.client as mqtt

def show(client, userdata, message):
    print("show")

client = None

client = mqtt.Client("scoreboard")
client.connect("localhost")
client.subscribe("foo/#")
client.message_callback_add("foo/show", show)
client.loop_forever(retry_first_connection=True)

shell #3
mosquitto_pub -t foo/show -m 1
# messages show up in #1 and 2

shell 4:
import paho.mqtt.client as mqtt

client = None

client = mqtt.Client("scoreboard")
client.connect("localhost")
client.loop_start()

client.publish("foo/show","1")

Shows up in #1, and now #2 seems un responsive

--
Carl K


--
Carl K

Back to the top