Tuesday, November 22, 2016

MQTT 以及 mosquitto


MQTT[1] (MQ Telemetry Transport or Message Queuing Telemetry Transport) is an ISO standard (ISO/IEC PRF 20922)[2] publish-subscribe-based "lightweight" messaging protocol for use on top of the TCP/IP protocol. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited. 

mosquitto is an MQTT v3.1 broker.

Usage: mosquitto [-c config_file] [-d] [-h] [-p port]

 -c : specify the broker config file.
 -d : put the broker into the background after starting.
 -h : display this help.
 -p : start the broker listening on the specified port.
      Not recommended in conjunction with the -c option.
 -v : verbose mode - enable all logging types. This overrides
      any logging options given in the config file.

See http://mosquitto.org/ for more information.




How to test mosquitto ?

use different terminal:

  • Run mosquitto

ex. mosquitto -p 192.168.157.75:1883

1479797828: mosquitto version 1.4.1 (build date 2016-02-25 01:02:01-0800) starting
1479797828: Using default config.
1479797828: Opening ipv4 listen socket on port 192.
1479797828: Opening ipv6 listen socket on port 192.

mosquitto_sub - mosquitto subscription client
  • Start the command line subscriber
mosquitto_sub -v -t 'test/topic' 
  • Publish test message with the command line publisher:
mosquitto_pub -t 'test/topic' -m 'helloWorld'

No comments:

Post a Comment

發表一下意見,互動一下唄!

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Adventure Book 2.0 Headline Animator

GoogleAd

funP Android 相關文章