Mosquitto缓冲不起作用

时间:2018-05-20 02:07:29

标签: node.js raspberry-pi mqtt

我有以下mosquitto.conf但是当互联网熄灭时,它不会缓冲并在互联网回来时发送到AWS IoT。

问题:

  1. 对于mosquitto配置我做错了什么,离线缓冲没有按预期工作?

  2. 我正在考虑在NodeJS上编写自己的桥。有关支持离线缓冲的NodeJS MQTT库的任何建议吗?

  3. 谢谢!

    pid_file /var/run/mosquitto.pid
    
    persistence true
    persistence_location /var/lib/mosquitto/
    
    log_dest file /var/log/mosquitto/mosquitto.log
    
    # =================================================================
    # Bridges to AWS IOT
    # =================================================================
    
    # AWS IoT endpoint, use AWS CLI 'aws iot describe-endpoint'
    connection awsiot
    address aws.iot.us-west-2.amazonaws.com:8883
    
    # Specifying which topics are bridged
    topic outTopic out 1
    
    # Setting protocol version explicitly
    bridge_protocol_version mqttv311
    bridge_insecure false
    
    # Bridge connection name and MQTT client Id,
    # enabling the connection automatically when the broker starts.
    cleansession true
    clientid bridgeawsiot
    start_type automatic
    notifications false
    log_type all
    
    cafile /home/pi/ca.crt
    keyfile /home/pi/server.key
    certfile /home/pi/server.crt
    tls_version tlsv1
    
    # =================================================================
    # Certificate based SSL/TLS support
    # -----------------------------------------------------------------
    #Path to the rootCA
    bridge_cafile /home/pi/rootCA.cer
    
    # Path to the PEM encoded client certificate
    bridge_certfile /home/pi/bridge.cert.pem
    
    # Path to the PEM encoded client private key
    bridge_keyfile /home/pi/bridge.private.key
    

1 个答案:

答案 0 :(得分:1)

网桥配置中的cleansession true表示当网桥关闭时没有消息排队。