Skip to content

MQTT: How to publish to all clients? #3032

Discussion options

You must be logged in to vote

If you to publish to all clients, then all those clients should be subscribed to a topic on the server.

cotonic.broker.subscribe("bridge/origin/my/topic", () => {
    console.log("hello")
})

And then on the server publish to my/topic

Note that all subscribes and publishes are ACL checked, so make certain that your topic can be subscribed to by the client.

For testing you can use the test or public topics, those are publicly available.

cotonic.broker.subscribe("bridge/origin/test/foo/bar", () => {
    console.log("hello")
})

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@abensoft-williamthome
Comment options

Answer selected by abensoft-williamthome
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants