Skip to content

KP5D/mosquito_res

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Pub/Sub with MQTT & mosquitto

  1. Run mosquitto broker (before any Pub/Sub is done)

    mosquitto -p '[PORT_NUMBER]'

    Default is 1883

  2. Pub/Sub commands

    mosquitto_sub -t '[TOPIC_NAME]'

    mosquitto_sub -h localhost -p [PORT_NUMBER] -t '[TOPIC_NAME]' -m '[MESSAGE]'

  3. Pub/Sub Combined

  • Publish & subscribe on the same .js script

    node local_pubsub.js

  1. Pub + Sub

    (In separate terminals)

    node local_sub.js

    node local_pub.js

  2. mosquitto config file

  1. Last Will & Testament

    mosquitto_sub -d -i Subscriber123 -h localhost -t presence --will-topic presence2 --will-payload "Problem with Subscriber123"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published